Fix for dumoing WITH/WITHOUT oids

Started by Bruce Momjianover 22 years ago5 messagespatches
Jump to latest
#1Bruce Momjian
bruce@momjian.us

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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/pgpatches/oidtext/plainDownload+142-88
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#1)
Re: Fix for dumoing WITH/WITHOUT oids

Bruce Momjian <pgman@candle.pha.pa.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

#3Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: Fix for dumoing WITH/WITHOUT oids

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#4Neil Conway
neilc@samurai.com
In reply to: Bruce Momjian (#1)
Re: Fix for dumoing WITH/WITHOUT oids

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

#5Bruce Momjian
bruce@momjian.us
In reply to: Neil Conway (#4)
Re: Fix for dumoing WITH/WITHOUT oids

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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073