Is there a way to perform a pg_dump and exclude the COMMENT ON for tables/views and columns ?
I use extensively the COMMENT ON command to describe all objects, and often include newlines in them for clearer descriptions, e.g.:
COMMENT ON TABLE mytable1 IS 'MAIN TABLE...
NOTES:
1. ...
2. ...
3. ...
';
However, since there are newlines in the dump as well, I cannot simply remove the comments with a grep -v 'COMMENT ON' command.
Any other way to quickly remove these COMMENT ON from the dump ?
pg_dump
– Czarismsed
orperl
script could do this, since the grammar ofCOMMENT ON
is pretty simple. All you'd need to do is make sure you got the string escape parsing correct, ignoring doubled quotes for cases likeCOMMENT ON ... 'It''s alright';
– Almetaalmighty