From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: inherited primary key misbehavior |
Date: | 2019-01-23 21:10:37 |
Message-ID: | 201901232110.oujq35tjmbfg@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello
On 2019-Jan-23, Amit Langote wrote:
> It seems that ATExecDetachPartition misses to mark a child's primary key
> constraint entry (if any) as local (conislocal=true, coninhcount=0), which
> causes this:
>
> create table p (a int primary key) partition by list (a);
> create table p2 partition of p for values in (2);
> alter table p detach partition p2;
> alter table p2 drop constraint p2_pkey ;
> ERROR: cannot drop inherited constraint "p2_pkey" of relation "p2"
Ugh.
I suppose unique keys would have the same problem, so the check for
indisprimary is wrong. Other than that, looks correct.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2019-01-23 21:13:14 | Re: problems with foreign keys on partitioned tables |
Previous Message | Donald Dong | 2019-01-23 19:26:40 | Re: Analyze all plans |