diff --git a/src/backend/distributed/operations/node_protocol.c b/src/backend/distributed/operations/node_protocol.c index 07ae278e9..c1483822a 100644 --- a/src/backend/distributed/operations/node_protocol.c +++ b/src/backend/distributed/operations/node_protocol.c @@ -562,9 +562,6 @@ GetTableConstructionCommands(Oid relationId) List *replicaIdentityEvents = GetTableReplicaIdentityCommand(relationId); tableDDLEventList = list_concat(tableDDLEventList, replicaIdentityEvents); - List *policyCommands = CreatePolicyCommands(relationId); - tableDDLEventList = list_concat(tableDDLEventList, policyCommands); - List *triggerCommands = GetExplicitTriggerCommandList(relationId); tableDDLEventList = list_concat(tableDDLEventList, triggerCommands); @@ -670,6 +667,9 @@ GetTableBuildingCommands(Oid relationId, bool includeSequenceDefaults) tableDDLEventList = lappend(tableDDLEventList, tableOwnerDef); } + List *policyCommands = CreatePolicyCommands(relationId); + tableDDLEventList = list_concat(tableDDLEventList, policyCommands); + /* revert back to original search_path */ PopOverrideSearchPath(); diff --git a/src/backend/distributed/operations/repair_shards.c b/src/backend/distributed/operations/repair_shards.c index 82fae08d6..7da8237eb 100644 --- a/src/backend/distributed/operations/repair_shards.c +++ b/src/backend/distributed/operations/repair_shards.c @@ -775,7 +775,7 @@ CopyShardCommandList(ShardInterval *shardInterval, const char *sourceNodeName, copyShardDataCommand->data); } - List *indexCommandList = GetTableIndexAndConstraintCommands(relationId); + List *indexCommandList = GetTableConstructionCommands(relationId); indexCommandList = WorkerApplyShardDDLCommandList(indexCommandList, shardId); copyShardToNodeCommandsList = list_concat(copyShardToNodeCommandsList,