fixup! Handle ADD FKEY commands in preprocess

pull/4453/head
Onur Tirtir 2021-01-05 19:41:19 +03:00
parent 487ce8fce0
commit f3f650c0b7
1 changed files with 9 additions and 7 deletions

View File

@ -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,11 +1000,11 @@ 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,
FindAlterTableCmdMatchingCheckFunction(AlterTableStmt *alterTableStatement,
AlterTableCommandFunc alterTableCommandFunc)
{
List *commandList = alterTableStatement->cmds;