Re: CREATE TABLE/AS does not allow WITH OIDS?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Thomas Lockhart <lockhart(at)fourpalms(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: CREATE TABLE/AS does not allow WITH OIDS?
Date: 2002-11-07 19:43:24
Message-ID: 28364.1036698204@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Neil Conway <neilc(at)samurai(dot)com> writes:
> Unless we can define some consistent semantics for when we use the
> hasoids of the source table(s), I'd say we should just add the
> WITH/WITHOUT OIDS syntax.

I agree with Neil: in many situations it's not reasonable to try to
associate a unique "source table" with a CREATE AS or SELECT INTO, and
therefore automatically propagating hasoids is doomed to failure.

A WITH/WITHOUT OIDS option on CREATE TABLE AS might be reasonable.

There are implementation gotchas to worry about. The reason the
behavior changed in 7.3 is that with the new OIDS-are-optional tuple
header layout, the top level plan node's tupdesc *must* have the correct
hasoids setting, and it turned out to be too difficult to back-patch
this decision into an already-built plan tree. It's hard even to get it
to work for INSERT/UPDATE (see the notes in ExecAssignResultTypeFromTL),
and SELECT INTO is such a wart on the side of the system that that
solution doesn't work for it (see the notes in InitPlan). This area
could use some rethinking in 7.4 (too late to mess with it for 7.3
though).

Someday it would be worth restructuring CREATE AS/SELECT INTO so that
they internally look like INSERT ... SELECT rather than a warty version
of SELECT. (But INSERT ... SELECT is pretty warty itself; someday we
need to fix the querytree structure so that there's not a forced
one-to-one relationship between targetlists and rangetables. INSERT
... SELECT would really prefer to have two tlists and only one rtable.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2002-11-07 20:09:41 Re: CREATE TABLE/AS does not allow WITH OIDS?
Previous Message joel w. reed 2002-11-07 19:42:29 Re: PL/Perl and Perl 5.8