Hi,
While reviewing the foreign keys referencing partitioned tables patch, I
noticed that the parentConstr argument of ATAddForeignConstraint is
rendered useless by the following commit:
commit 0325d7a5957ba39a0dce90835ab54a08ab8bf762
Author: Alvaro Herrera <[email protected]>
Date: Fri Jan 18 14:49:40 2019 -0300
Fix creation of duplicate foreign keys on partitions
Above commit added another function specialized for recursively adding a
given foreign key constraint to partitions, so ATAddForeignConstraint is
no longer called recursively.
Maybe remove that argument in HEAD ? Attached a patch.
Thanks,
Amit
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 715c6a221c..f225c494bd 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -404,7 +404,7 @@ static ObjectAddress ATAddCheckConstraint(List **wqueue,
bool recurse, bool recursing, bool
is_readd,
LOCKMODE lockmode);
static ObjectAddress ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo
*tab,
- Relation rel, Constraint
*fkconstraint, Oid parentConstr,
+ Relation rel, Constraint
*fkconstraint,
bool recurse, bool recursing,
LOCKMODE lockmode);
static void CloneForeignKeyConstraints(Oid parentId, Oid relationId,
@@ -7077,7 +7077,7 @@ ATExecAddConstraint(List **wqueue, AlteredTableInfo *tab,
Relation rel,
NIL);
address = ATAddForeignKeyConstraint(wqueue, tab, rel,
-
newConstraint, InvalidOid,
+
newConstraint,
recurse, false,
lockmode);
break;
@@ -7236,7 +7236,7 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo
*tab, Relation rel,
*/
static ObjectAddress
ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
- Constraint *fkconstraint, Oid
parentConstr,
+ Constraint *fkconstraint,
bool recurse, bool recursing,
LOCKMODE lockmode)
{
Relation pkrel;
@@ -7607,7 +7607,7 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo
*tab, Relation rel,
fkconstraint->deferrable,
fkconstraint->initdeferred,
fkconstraint->initially_valid,
-
parentConstr,
+
InvalidOid,
RelationGetRelid(rel),
fkattnum,
numfks,