From 154c5baaa0653bd6af120b5949e6ec234dc19dce Mon Sep 17 00:00:00 2001 From: Onur Tirtir Date: Tue, 5 Jan 2021 14:04:31 +0300 Subject: [PATCH] fixup! Consider fkey graph invalidations due to CREATE TABLE cmds too --- .../distributed/commands/utility_hook.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/backend/distributed/commands/utility_hook.c b/src/backend/distributed/commands/utility_hook.c index 6f7527601..aa5481737 100644 --- a/src/backend/distributed/commands/utility_hook.c +++ b/src/backend/distributed/commands/utility_hook.c @@ -543,16 +543,6 @@ multi_ProcessUtility(PlannedStmt *pstmt, 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) @@ -587,6 +577,16 @@ multi_ProcessUtility(PlannedStmt *pstmt, PostprocessAlterTableStmtAttachPartition(alterTableStatement, 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(); + /* after local command has completed, finish by executing worker DDLJobs, if any */ if (ddlJobs != NIL) {