Re: partitioned tables referenced by FKs
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2018-11-30T19:12:16Z
Lists: pgsql-hackers
Attachments
- 0001-Refactor-DeconstructConstraintRow.patch (text/x-diff)
Here's a more credible version of this patch series. 0001 refactors some duplicative code that interprets a pg_constraint row for a foreign key back into a Constraint node. Only what is necessary for current features is read. 0002 moves some code that I added in 3de241dba86f to src/backend/catalog/pg_constraint.c so that it appears in tablecmds.c instead. After developing the current patch I realized that the latter is its natural home. 0003 changes the shape of a loop in deleteObjectsInList, so that I can add object type-specific functions to be called before deleting an object. This is needed by 0004 and makes no sense on its own; I would probably push both together, but splitting it like this makes it very obvious what it is I'm doing. 0004 adds the feature itself In 0004 there's also a new function "index_get_partition" which allows to simplify some code I added in 8b08f7d4820f. I will probably split it up and commit separately because it's an obvious code beautify. 0005 modifies psql to show the constraint in a different way, which makes more sense overall (rather than show the "internal" constraint that concerns the partition, show the top-level contraint that concerns the ancestor table on which it is defined. This includes naming the table in which the constraint is defined). There's one half of 0005 that I think should be applied to pg11, because when partitions have foreign keys, the display looks a bit odd currently. The other half I would probably merge into 0004 instead of committing separately. Even if not backpatched, it makes sense to apply ahead of the rest because it changes expected output for a regression test. -- Á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