BUG #18541: Reattaching a partition referenced by a foreign key fails with an error

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #18541: Reattaching a partition referenced by a foreign key fails with an error
Date: 2024-07-15 10:00:01
Message-ID: 18541-628a61bc267cd2d3@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18541
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 17beta2
Operating system: Ubuntu 22.04
Description:

The following script:
CREATE TABLE t1 (a int, PRIMARY KEY (a));
CREATE TABLE t (a int, PRIMARY KEY (a), FOREIGN KEY (a) REFERENCES t1)
PARTITION BY LIST (a);
ALTER TABLE t ATTACH PARTITION t1 FOR VALUES IN (1);
ALTER TABLE t DETACH PARTITION t1;
ALTER TABLE t ATTACH PARTITION t1 FOR VALUES IN (1);

ends up with the error complaining about check triggers:
ERROR: XX000: could not find ON INSERT check triggers of foreign key
constraint 16400
LOCATION: GetForeignKeyCheckTriggers, tablecmds.c:11260

Reproduced on REL_15_STABLE (starting from f4566345c) .. master.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Etsuro Fujita 2024-07-15 10:51:03 Re: BUG #17889: Invalid cursor direction for a foreign scan that reached the fetch_size (MOVE BACKWARD ALL IN cX)
Previous Message PG Bug reporting form 2024-07-15 08:28:26 BUG #18540: Does PG16 standby database support function pg_replication_origin_advance?