Re: Constraint's NO INHERIT option is ignored in CREATE TABLE LIKE statement

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Constraint's NO INHERIT option is ignored in CREATE TABLE LIKE statement
Дата
Msg-id CAKFQuwaOrqw-HGSTzWOyDhe=bPMQRoQKGVGZ2wGx7_Ume_ztZQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Constraint's NO INHERIT option is ignored in CREATE TABLE LIKE statement  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Constraint's NO INHERIT option is ignored in CREATE TABLE LIKE statement  (Amit Langote <amitlangote09@gmail.com>)
Список pgsql-hackers
On Wed, Feb 19, 2020 at 4:02 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Ildar Musin <ildar@adjust.com> writes:
> My colleague Chris Travers discovered something that looks like a bug.
> Let's say we have a table with a constraint that is declared as NO INHERIT.
> ...
> Now when we want to make a copy of the table structure into a new table
> the `NO INHERIT` option is ignored.

Hm, I agree that's a bug, since the otherwise-pretty-detailed CREATE TABLE
LIKE documentation makes no mention of such a difference between original
and cloned constraint.

However, I'd be disinclined to back-patch, since it's barely possible
somebody out there is depending on the existing behavior.

Not sure I agree with the premise that it is not supposed to be copied; is there some other object type the allows NO INHERIT that isn't copied when CREATE TABLE LIKE is used and check constraints are the odd ones out?

Inheritance is what NO INHERIT is about and CREATE TABLE LIKE pointedly doesn't setup an inheritance structure.  The documentation seems ok since saying that NO INHERIT is ignored when inheritance is not being used seems self-evident.  Sure, maybe some clarity here could be had, but its not like this comes up with any regularity.

David J.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Constraint's NO INHERIT option is ignored in CREATE TABLE LIKE statement
Следующее
От: David Fetter
Дата:
Сообщение: Re: Parallel copy