deferrable FK constraints on partitioned rels
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-11-05T19:19:48Z
Lists: pgsql-hackers
Attachments
- 0001-Fix-deferred-constraints-on-partitioned-rels.patch (text/x-diff)
While messing around, I noticed that SET CONSTRAINTS ... DEFERRED does not work with partitioned tables. I had some code to cover this case, but it has a bug that prevents it from working at all: the sanity check that verifies whether triggers exist fails. The attached patch fixes this problem: it merely removes the sanity check. With that, everything works. (Another approach I tried was to split out constraints in partitioned tables vs. constraints in regular ones. That's indeed workable, but it requires us to do two additional syscache access per partition for get_rel_relkind, which seems excessive.) The UNIQUE DEFERRABLE case works after the patch. (I didn't try without the patch.) -- Álvaro Herrera Developer, https://www.PostgreSQL.org/
Commits
-
Fix SET CONSTRAINTS .. DEFERRED on partitioned tables
- e4baecf1e162 11.6 landed
- b75ccddcd6f7 12.1 landed
- b4bcc6bfdfa2 13.0 landed