Re: [HACKERS] pg_dump --comment?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jon Jensen <jon(at)endpoint(dot)com>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Chris Campbell <chris(at)bignerdranch(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] pg_dump --comment?
Date: 2004-06-05 04:57:42
Message-ID: 200406050457.i554vg312811@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Tom Lane wrote:
> >> What happens in a pg_dump -Fc / pg_restore scenario?
>
> > So, in non-ascii format, I need to dump a comment record and read it
> > back on restore? Yuck. Anyone want to tackle that?
>
> Yes. Hacking the output routines alone is almost never the right way
> to do things in pg_dump.
>
> My feeling is that if anyone cares to tackle this, it would be
> appropriate to add a record type that carries a user-supplied
> comment, and then people could do something like
> pg_dump --comment "generated on `date`"
> if they want to have a timestamp. I don't want a timestamp put
> into the file by default, because that creates problems for
> comparing dump files.

OK, new patch. This puts start/stop times into dumps if you use -v
during dumping. It creates a new node type:

--
-- PostgreSQL database dump
--

SET client_encoding = 'SQL_ASCII';
SET check_function_bodies = false;

--
-- Name: DUMP TIMESTAMP; Type: DUMP TIMESTAMP; Schema: -; Owner:
--

-- Started on 2004-06-05 00:41:25 EDT

...

--
-- Name: DUMP TIMESTAMP; Type: DUMP TIMESTAMP; Schema: -; Owner:
--

-- Completed on 2004-06-05 00:44:28 EDT


--
-- PostgreSQL database dump complete
--

One issue is that the system dumps certain settings into the output file
in ascii dumps, but pg_restore sets them on its own during the restore.
Because the timestamp can't be done during pg_restore, it has to be a
special node.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 4.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Garamond 2004-06-05 08:28:25 Re: [HACKERS] Not 7.5, but 8.0 ?
Previous Message Tom Lane 2004-06-05 04:55:53 Re: TimeOf(Subselects|Joins)FromLargeTables?

Browse pgsql-patches by date

  From Date Subject
Next Message Laurent Ballester 2004-06-05 08:45:15 Re: eventlog fix
Previous Message Tom Lane 2004-06-04 13:43:53 Re: [HACKERS] pg_dump --comment?