Re: Fix for dumoing WITH/WITHOUT oids

Lists: pgsql-patches
From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Fix for dumoing WITH/WITHOUT oids
Date: 2004-03-23 20:02:21
Message-ID: 200403232002.i2NK2Mr18107@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

The attached patch prevents WITH/WITHOUT OIDS from appearing in pg_dump
output. Instead, it uses "SET default_with_oids" to control oid
creation, but only outputs it when the table characteristics change, not
for every table.

The patch basically add a withOids field to the table of contents
(TocEntry). TocEntries are part of our binary dumps. I updated the
pg_dump version number. The code conditinally reads the TocEntry and
reads this field if the version is as new as the new 1.9 version.

The patch adds a new ArchiveHandle.currWithOids to track the current
backend default_with_oids setting. This boolean variable is set to -1
on new connection so it will trigger a SET when first used.

The majority of the patch is adding withOids to all the ArchiveEntry
calls, even though it is only used for the TABLE tag.

I have tested this patch in both binary and ASCII outputs. Binary gets
the OID setting from the TocEntry, while ASCII keeps track of the OID
setting.

--
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 26.3 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Fix for dumoing WITH/WITHOUT oids
Date: 2004-03-23 20:52:27
Message-ID: 29090.1080075147@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> /*
> + * Become the owner of the the given TOC entry object. If
> + * changes in ownership are not allowed, this doesn't do anything.
> + */
> + static void
> + _setWithOids(ArchiveHandle *AH, TocEntry *te)

Cutting and pasting our comments, are we?

regards, tom lane


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: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Fix for dumoing WITH/WITHOUT oids
Date: 2004-03-23 21:34:01
Message-ID: 200403232134.i2NLY1O02916@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > /*
> > + * Become the owner of the the given TOC entry object. If
> > + * changes in ownership are not allowed, this doesn't do anything.
> > + */
> > + static void
> > + _setWithOids(ArchiveHandle *AH, TocEntry *te)
>
> Cutting and pasting our comments, are we?

Thanks. Fixed. :-)

--
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


From: Neil Conway <neilc(at)samurai(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Fix for dumoing WITH/WITHOUT oids
Date: 2004-03-24 02:31:05
Message-ID: 4CADE7D2-7D3B-11D8-8EB3-000A95AB279E@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On 23-Mar-04, at 3:02 PM, Bruce Momjian wrote:
> The attached patch prevents WITH/WITHOUT OIDS from appearing in pg_dump
> output. Instead, it uses "SET default_with_oids" to control oid
> creation, but only outputs it when the table characteristics change,
> not
> for every table.

Thank you for doing this, Bruce. My apologies for not getting it done
fast enough myself.

-Neil


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Fix for dumoing WITH/WITHOUT oids
Date: 2004-03-24 03:02:33
Message-ID: 200403240302.i2O32Xo10096@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Neil Conway wrote:
> On 23-Mar-04, at 3:02 PM, Bruce Momjian wrote:
> > The attached patch prevents WITH/WITHOUT OIDS from appearing in pg_dump
> > output. Instead, it uses "SET default_with_oids" to control oid
> > creation, but only outputs it when the table characteristics change,
> > not
> > for every table.
>
> Thank you for doing this, Bruce. My apologies for not getting it done
> fast enough myself.

No problem. I think we are better leaving you the more complex stuff. :-)

--
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