pg_dump --comment?

From: Chris Campbell <chris(at)bignerdranch(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_dump --comment?
Date: 2004-05-28 02:10:14
Message-ID: 40B69F86.2020002@bignerdranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

I've encountered a situation where I'd like to store some information
about the database when I do a pg_dump. For instance, the timestamp of
the dump. And some other information that I pull from the database.

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Erwin Brandstetter 2004-05-28 02:18:13 Dynamic fieldname with NEW structure in trigger function?
Previous Message Christopher Kings-Lynne 2004-05-28 02:04:56 Re: Win32, PITR, nested transactions, tablespaces

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-05-28 02:37:35 Re: win32 locale fixes
Previous Message Gavin Sherry 2004-05-28 01:25:25 Re: Tablespaces