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

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ildar Musin <ildar(at)adjust(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Constraint's NO INHERIT option is ignored in CREATE TABLE LIKE statement
Date: 2020-02-20 02:53:09
Message-ID: CA+HiwqGHoWJg+djrQh1QD0Gx4+6Bi57qWa_jz-rENaYhEP=UNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 20, 2020 at 8:20 AM David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> On Wed, Feb 19, 2020 at 4:02 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Ildar Musin <ildar(at)adjust(dot)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?

Syntax currently allows only CHECK constraints to be marked NO INHERIT.

Thanks,
Amit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-02-20 03:23:26 Re: Clean up some old cruft related to Windows
Previous Message Amit Langote 2020-02-20 02:36:12 Re: Constraint's NO INHERIT option is ignored in CREATE TABLE LIKE statement