Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?
Date
Msg-id 22687.1430017912@sss.pgh.pa.us
Whole thread Raw
In response to Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?
List pgsql-hackers
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Saturday, April 25, 2015, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Still another case that needs to be thought about is "create table likeit
>> (like base) without oids" where base does have OIDs.  Probably the right
>> thing here is to let the WITHOUT OIDS spec override what we see in base.

> Why are oids special in this manner?  No other inherited column can be
> omitted from the child table.

Hm, good point; INHERITS will silently override such a specification:

regression=# create table base1 (f1 int) with oids;
CREATE TABLE
regression=# create table c2 () inherits (base1) without oids;
CREATE TABLE
regression=# \d+ c2                         Table "public.c2"Column |  Type   | Modifiers | Storage | Stats target |
Description
 
--------+---------+-----------+---------+--------------+-------------f1     | integer |           | plain   |
  | 
 
Inherits: base1
Has OIDs: yes

> Though I guess unlike inherits there is no
> reason to mandate the final result be identical to the base table - though
> here is something to be said for pointing out the inconsistency and
> requiring the user to alter table if indeed they want to have the oid-ness
> changed.

Yeah, LIKE doesn't necessarily have to behave the same as INHERITS;
but probably we should follow that precedent unless we have a specific
argument not to.  Which I don't.
        regards, tom lane



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?
Next
From: Amit Kapila
Date:
Subject: Re: a fast bloat measurement tool (was Re: Measuring relation free space)