Re: pg_dump --comment?

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Chris Campbell <chris(at)bignerdranch(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump --comment?
Date: 2004-05-31 13:01:39
Message-ID: 40BB2CB3.8090102@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

This can be accomplished with 10-20 lines of shell scripting. I don't
think it's worth the trouble bloating pg_dump with it at all.

Jan

On 5/27/2004 10:10 PM, Chris Campbell wrote:
> 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

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-05-31 13:11:42 Re: Converting postgresql.conf parameters to kilobytes
Previous Message Harald Fuchs 2004-05-31 12:39:01 Re: Converting postgresql.conf parameters to kilobytes

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-05-31 13:37:36 Re: pg_dump --comment?
Previous Message Tom Lane 2004-05-31 06:31:14 Re: CVS tip problems