Re: partitioned tables referenced by FKs
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2019-02-22T15:39:44Z
Lists: pgsql-hackers
Attachments
Here's another rebase. The code is structured somewhat differently from the previous one, mostly because of the backpatched bugfixes, but also because of the changes in dependency handling. I think there's also at least one more bugfix to backpatch (included in 0003 here), related to whether foreign tables are allowed as having FKs, but AFAICS it just cosmetic: you get an error if you have a foreign partition and add a FK, but it says "you cannot have constraint triggers" rather than "FKs are not supported", so it's a bit odd. 0003 also includes Amit L's patch to remove the parentConstraint argument from ATExecAddForeignKey, which I suppose I should commit separately. Odd bugs fixed: a) handle the case where the default partition is the only one and it's being detached or dropped. b) when a partition was dropped/detached from the referenced side, the child constraint was left in place. I have not yet fixed the "#if 0" section. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Support foreign keys that reference partitioned tables
- f56f8f8da6af 12.0 landed
-
Fix partitioned index creation bug with dropped columns
- 7009f1a2df65 11.3 landed
- 126d63122232 12.0 landed
-
Improve psql's \d display of foreign key constraints
- 1af25ca0c2d9 12.0 cited
-
Fix dependency recording bug for partitioned PKs
- 7e7c57bbb2eb 12.0 landed
-
Add index_get_partition convenience function
- a6da0047158b 12.0 landed
-
Restore RI trigger sanity check
- 815b20ae0c6e 12.0 landed
- 04f9b449aa30 11.3 landed
-
Foreign keys on partitioned tables
- 3de241dba86f 11.0 cited