If pg_dump had a --comment flag that allowed me to pass a string that would be stored inside the dumpfile, that I could then retrieve in some way (without doing a full restore of the dump), that would meet my needs. In discussing this idea with other people, it sounded like a general-use feature that mankind as a whole could benefit from. :)
Here's what I'm envisioning:
pg_dump --comment 'This is a comment' <more pg_dump args>
That would store the comment ('This is a comment') in the dump file somehow. The definition of "somehow" would vary depending on the output format (text, tar, or custom). Initially, since I only use the custom format, I would only focus on getting it to work with that. But for the text format, there could be a SQL comment at the top of the file with
-- COMMENT: This is a comment
or something. In the tar format, there could be a "comment" file in the archive that contains the text "This is a comment".
For the custom format...I haven't looked at the format specification, so I don't know exactly where the comment would go. It could go at the very top of the file, and have a special delimiter after it. pg_restore would just skim over the file until the delimiter is reached, and then go on about its business. The benefit of this scheme is that any program could read the comment -- just open a file and read the bytes until the delimiter.
There could also be a pg_dump or pg_restore option that prints out the comment stored in a given dump file, or another binary (pg_comment?) that does that.
Is this a desirable feature? Should I work it up like described and submit a patch? Any comments/suggestions?
Thanks!
- Chris
smime.p7s
Description: S/MIME Cryptographic Signature