Re: pg_dump --comment? - Mailing list pgsql-hackers

From Jan Wieck
Subject Re: pg_dump --comment?
Date
Msg-id 40BB2CB3.8090102@Yahoo.com
Whole thread Raw
In response to pg_dump --comment?  (Chris Campbell <chris@bignerdranch.com>)
Responses Re: pg_dump --comment?
List pgsql-hackers
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@Yahoo.com #



pgsql-hackers by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: Can't detect time zone
Next
From: Bruce Momjian
Date:
Subject: Re: Converting postgresql.conf parameters to kilobytes