Re: add "WITH OIDS" to CREATE TABLE AS

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: add "WITH OIDS" to CREATE TABLE AS
Date: 2004-01-07 20:10:41
Message-ID: 200401072010.i07KAfd15847@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Neil Conway wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Couldn't we use SET only when we need to change the existing value?
>
> I'm not sure what you mean. The pg_dump output will look like:
>
> -- at the top of the dump
> SET default_with_oids = false; -- or true, doesn't really matter
>
> -- for a table that doesn't have OIDs
> CREATE TABLE (...);
>
> -- for a table that does have OIDs
> SET default_with_oids = true;
> CREATE TABLE (...);
> SET default_with_oids = false;
>
> The point is that in this example if all the tables in the DB have
> OIDs, you'll emit two SETs for each CREATE TABLE, so what you'd really
> like is to have chosen a different default to begin with.
>
> Anyway, it's just an implementation detail: I'll definitely implement
> it one way or another in time for 7.5 (unless someone else would like
> to do it, in which case I'd gladly step aside).

I assume we would _remember_ the current with_oids value inside pg_dump.

For example, if I create two tables as user 'guest', I see in pg_dump
output:

SET SESSION AUTHORIZATION 'guest';

--
-- Name: g1; Type: TABLE; Schema: public; Owner: guest
--

CREATE TABLE g1 (
x integer
) WITH OIDS;


--
-- Name: g2; Type: TABLE; Schema: public; Owner: guest
--

CREATE TABLE g2 (
x integer
) WITH OIDS;


SET SESSION AUTHORIZATION 'postgres';

Notice that only one SESSION AUTHORIZATION is used for guest. Can't we
do the same for WITH/WITHOUT OIDS?

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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-01-07 21:52:38 Re: SIGPIPE handling
Previous Message Peter Eisentraut 2004-01-07 17:44:22 Re: update for brazilian portuguese translation