Re: BUG #15425: DETACH/ATTACH PARTITION bug - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: BUG #15425: DETACH/ATTACH PARTITION bug
Date
Msg-id 20181010164728.ymzfjw6loxj6flx6@alvherre.pgsql
Whole thread Raw
In response to BUG #15425: DETACH/ATTACH PARTITION bug  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #15425: DETACH/ATTACH PARTITION bug  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-bugs
On 2018-Oct-10, PG Bug reporting form wrote:

> After I DETACH a partition, and then try to ATTACH it again, I get errors:
> ERROR:  duplicate key value violates unique constraint
> "pg_constraint_conrelid_contypid_conname_index"
> DETAIL:  Key (conrelid, contypid, conname)=(26702, 0,
> test_result_asset_id_fkey) already exists.
> 
> It looks like it is trying to add the foreign key again.

Thanks.  Reproduced with

create table main (a int primary key);
create table part (a int references main) partition by range (a);
create table part1 partition of part for values from (1) to (100);
alter table part detach partition part1;
alter table part attach partition part1 for values from (1) to (100);

Looking into it.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #15425: DETACH/ATTACH PARTITION bug
Next
From: PG Bug reporting form
Date:
Subject: BUG #15426: A prior column in a default expression of an xmltable()call does not exist