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

Поиск
Список
Период
Сортировка
От Ildar Musin
Тема Constraint's NO INHERIT option is ignored in CREATE TABLE LIKE statement
Дата
Msg-id CAONYFtMC6C+3AWCVp7Yd8H87Zn0GxG1_iQG6_bQKbaqYZY0=-g@mail.gmail.com
обсуждение исходный текст
Ответы Re: Constraint's NO INHERIT option is ignored in CREATE TABLE LIKE statement  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi hackers,

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.

CREATE TABLE test (
    x INT CHECK (x > 0) NO INHERIT
);
\d test
                Table "public.test"
 Column |  Type   | Collation | Nullable | Default
--------+---------+-----------+----------+---------
 x      | integer |           |          |
Check constraints:
    "test_x_check1" CHECK (x > 0) NO INHERIT

Now when we want to make a copy of the table structure into a new table
the `NO INHERIT` option is ignored.

CREATE TABLE test2 (LIKE test INCLUDING CONSTRAINTS);
\d test2
               Table "public.test2"
 Column |  Type   | Collation | Nullable | Default
--------+---------+-----------+----------+---------
 x      | integer |           |          |
Check constraints:
    "test_x_check1" CHECK (x > 0)

Is this a bug or expected behaviour? Just in case I've attached a patch
that fixes this.

Regards,
Ildar
Вложения

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

Предыдущее
От: ahsan hadi
Дата:
Сообщение: Re: DROP OWNED CASCADE vs Temp tables
Следующее
От: Hamid Akhtar
Дата:
Сообщение: Re: Do we need to handle orphaned prepared transactions in the server?