Summary:
PG12 added support for foreign keys that reference partitioned tables (commit f56f8f8da6afd8523b4d5284e02a20ed2b33ef8d). This revision enables this feature on YB.
In commit 3a4b1562c5897c16a3f25555d1eb12f7748f499b/D9337, YB introduced an optimization to batch the foreign key violation lookups to reduce the number of RPCs. This revision enhances it such that it also works when the referenced relation is partitioned. This essentially involves performing partition routing on the root-referenced relation to find the leaf relation referenced by the foreign key constraint.
Jira: DB-7876
Test Plan:
./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressForeignKey'
Reviewers: dmitry
Reviewed By: dmitry
Subscribers: dmitry, yql
Differential Revision: https://phorge.dev.yugabyte.com/D37933