Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?
Date: 2015-04-26 03:11:52
Message-ID: 22687.1430017912@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Saturday, April 25, 2015, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2015-04-26 03:13:06 Re: a fast bloat measurement tool (was Re: Measuring relation free space)
Previous Message David G. Johnston 2015-04-26 02:55:27 Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?