From 4f69298d90fbd32a16e9b65489861e49c4676395 Mon Sep 17 00:00:00 2001 From: Marco Slot Date: Thu, 1 Oct 2020 18:04:55 +0200 Subject: [PATCH] Fix RLS and replica identity propagation on shard move --- src/backend/distributed/operations/node_protocol.c | 6 +++--- src/backend/distributed/operations/repair_shards.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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,