Consider fkey graph invalidations due to CREATE TABLE cmds too

pull/4453/head
Onur Tirtir 2020-12-24 17:10:15 +03:00
parent 3f2a52b7ce
commit 51ab536eed
1 changed files with 18 additions and 17 deletions

View File

@ -524,6 +524,24 @@ multi_ProcessUtility(PlannedStmt *pstmt,
/*
* Post process for ddl statements
*/
if (IsA(parsetree, CreateStmt))
{
CreateStmt *createStatement = (CreateStmt *) parsetree;
PostprocessCreateTableStmt(createStatement, queryString);
}
/*
* Re-forming the foreign key graph relies on the command being executed
* on the local table first. However, in order to decide whether the
* command leads to an invalidation, we need to check before the command
* is being executed since we read pg_constraint table. Thus, we maintain a
* local flag and do the invalidation after multi_ProcessUtility,
* before ExecuteDistributedDDLJob().
*/
InvalidateForeignKeyGraphForDDL();
if (EnableDDLPropagation)
{
if (ops && ops->postprocess)
@ -547,13 +565,6 @@ multi_ProcessUtility(PlannedStmt *pstmt,
}
}
if (IsA(parsetree, CreateStmt))
{
CreateStmt *createStatement = (CreateStmt *) parsetree;
PostprocessCreateTableStmt(createStatement, queryString);
}
/*
* We only process ALTER TABLE ... ATTACH PARTITION commands in the function below
* and distribute the partition if necessary.
@ -890,16 +901,6 @@ static void
PostStandardProcessUtility(Node *parsetree)
{
DecrementUtilityHookCountersIfNecessary(parsetree);
/*
* Re-forming the foreign key graph relies on the command being executed
* on the local table first. However, in order to decide whether the
* command leads to an invalidation, we need to check before the command
* is being executed since we read pg_constraint table. Thus, we maintain a
* local flag and do the invalidation after multi_ProcessUtility,
* before ExecuteDistributedDDLJob().
*/
InvalidateForeignKeyGraphForDDL();
}