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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?
Дата
Msg-id 21163.1430014572@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
Bruce Momjian <bruce@momjian.us> writes:
> I have changed the default value back to the function call as it should
> have been all along;  patch attached.  I will revisit this for 9.6
> unless I hear otherwise.

I still don't like this patch one bit.  I don't think that this code
should be modifying stmt->options that way.  Also, you have not addressed
whether this is even the right semantics.  In particular, currently
default_with_oids will force an OID column to exist regardless of whether
the LIKE-referenced table has them:

regression=# create table base (f1 int);
CREATE TABLE
regression=# set default_with_oids = true;
SET
regression=# create table likeit (like base);
CREATE TABLE
regression=# \d+ base                        Table "public.base"Column |  Type   | Modifiers | Storage | Stats target |
Description
 
--------+---------+-----------+---------+--------------+-------------f1     | integer |           | plain   |
  | 
 

regression=# \d+ likeit                       Table "public.likeit"Column |  Type   | Modifiers | Storage | Stats
target| Description 
 
--------+---------+-----------+---------+--------------+-------------f1     | integer |           | plain   |
  | 
 
Has OIDs: yes

Another variant is "create table likeit (like base) with oids".

It's perhaps debatable whether it should act that way, but in the absence
of complaints from the field, I'm hesitant to change these cases.  It
might be better if the effective behavior were "table gets OIDs if
default_with_oids = true or WITH OIDS is given or base table has OIDs".

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.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?