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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?
Дата
Msg-id 22687.1430017912@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?  (Bruce Momjian <bruce@momjian.us>)
Список 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 по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: a fast bloat measurement tool (was Re: Measuring relation free space)