From f3f650c0b7f248af9b5c6302ebc0df4315e2052d Mon Sep 17 00:00:00 2001 From: Onur Tirtir Date: Tue, 5 Jan 2021 19:41:19 +0300 Subject: [PATCH] fixup! Handle ADD FKEY commands in preprocess --- src/backend/distributed/commands/table.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/backend/distributed/commands/table.c b/src/backend/distributed/commands/table.c index 4e002f9ac..227486d4d 100644 --- a/src/backend/distributed/commands/table.c +++ b/src/backend/distributed/commands/table.c @@ -55,8 +55,9 @@ static void ErrorIfAlterTableDefinesFKeyFromPostgresToCitusLocalTable( static List * GetAlterTableStmtFKeyConstraintList(AlterTableStmt *alterTableStatement); static List * GetAlterTableCommandFKeyConstraintList(AlterTableCmd *command); static bool AlterTableCommandTypeIsTrigger(AlterTableType alterTableType); -static bool AlterTableHasCommandByFunc(AlterTableStmt *alterTableStatement, - AlterTableCommandFunc alterTableCommandFunc); +static bool FindAlterTableCmdMatchingCheckFunction(AlterTableStmt *alterTableStatement, + AlterTableCommandFunc + alterTableCommandFunc); static bool AlterTableCmdAddsOrDropsFkey(AlterTableCmd *command, Oid relationId); static bool AlterTableCmdAddsFKey(AlterTableCmd *command, Oid relationId); static bool AlterTableCmdDropsFkey(AlterTableCmd *command, Oid relationId); @@ -408,7 +409,8 @@ PreprocessAlterTableStmt(Node *node, const char *alterTableCommand) */ ErrorIfAlterTableDefinesFKeyFromPostgresToCitusLocalTable(alterTableStatement); - if (AlterTableHasCommandByFunc(alterTableStatement, AlterTableCmdAddsOrDropsFkey)) + if (FindAlterTableCmdMatchingCheckFunction(alterTableStatement, + AlterTableCmdAddsOrDropsFkey)) { MarkInvalidateForeignKeyGraph(); } @@ -998,12 +1000,12 @@ PostprocessAlterTableStmt(AlterTableStmt *alterTableStatement) /* - * AlterTableHasCommandByFunc returns true if given alterTableCommandFunc returns - * true for any subcommand of alterTableStatement. + * FindAlterTableCmdMatchingCheckFunction returns true if given alterTableCommandFunc + * returns true for any subcommand of alterTableStatement. */ static bool -AlterTableHasCommandByFunc(AlterTableStmt *alterTableStatement, - AlterTableCommandFunc alterTableCommandFunc) +FindAlterTableCmdMatchingCheckFunction(AlterTableStmt *alterTableStatement, + AlterTableCommandFunc alterTableCommandFunc) { List *commandList = alterTableStatement->cmds; AlterTableCmd *command = NULL;