[HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column

Поиск
Список
Период
Сортировка
От Amit Langote
Тема [HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column
Дата
Msg-id cb13cfe7-a48c-5720-c383-bb843ab28298@lab.ntt.co.jp
обсуждение исходный текст
Ответы Re: [HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column
Re: [HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column
Список pgsql-hackers
I suspect the following is a bug:

create table foo (a int) with oids;
CREATE TABLE
create table bar (a int);
CREATE TABLE
alter table bar inherit foo;
ERROR:  table "bar" without OIDs cannot inherit from table "foo" with OIDs

alter table bar set with oids;
ALTER TABLE
alter table bar inherit foo;
ALTER TABLE

alter table foo set without oids;
ERROR:  relation 16551 has non-inherited attribute "oid"

Because:

select attinhcount from pg_attribute where attrelid = 'bar'::regclass and
attname = 'oid';
 attinhcount
-------------
           0
(1 row)

Which also means "oid" can be safely dropped from bar breaking the
invariant that if the parent table has oid column, its child tables must too:

alter table bar drop oid;  -- or, alter table bar set without oids;
ALTER TABLE

Attached patches modifies MergeAttributesIntoExisting() such that we
increment attinhcount not only for user attributes, but also for the oid
system column if one exists.

Thoughts?

Thanks,
Amit

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Вложения

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: [HACKERS] proposal: session server side variables
Следующее
От: Amit Langote
Дата:
Сообщение: Re: [HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column