BUG #18541: Reattaching a partition referenced by a foreign key fails with an error
The Post Office <noreply@postgresql.org>
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: exclusion@gmail.com
Date: 2024-07-15T10:00:01Z
Lists: pgsql-bugs
The following bug has been logged on the website: Bug reference: 18541 Logged by: Alexander Lakhin Email address: exclusion@gmail.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.
Commits
-
Restructure foreign key handling code for ATTACH/DETACH
- d20194cead75 13.17 landed
- 5d83bad6b87d 15.9 landed
- 5914a22f6ea5 17.1 landed
- 53af9491a043 18.0 landed
- 46a8c27a7226 14.14 landed
- 2aaf2a28b87e 16.5 landed
-
Refuse ATTACH of a table referenced by a foreign key
- e97121d90e91 14.14 landed
- ada34d7146c3 16.5 landed
- a90bdd7a44d0 18.0 landed
- 8c0944ac878d 15.9 landed
- 344f9f5e2b18 17.0 landed
- 2ee02c98dd17 13.17 landed
- 17ed92e1ff60 12.21 landed