summaryrefslogtreecommitdiff
path: root/src/backend/replication/logical/worker.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/replication/logical/worker.c')
-rw-r--r--src/backend/replication/logical/worker.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index f9efe6c4c67..96772e4d73a 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -156,6 +156,7 @@
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "optimizer/optimizer.h"
+#include "parser/parse_relation.h"
#include "pgstat.h"
#include "postmaster/bgworker.h"
#include "postmaster/interrupt.h"
@@ -516,6 +517,8 @@ create_edata_for_relation(LogicalRepRelMapEntry *rel)
rte->rellockmode = AccessShareLock;
ExecInitRangeTable(estate, list_make1(rte));
+ addRTEPermissionInfo(&estate->es_rteperminfos, rte);
+
edata->targetRelInfo = resultRelInfo = makeNode(ResultRelInfo);
/*
@@ -1813,6 +1816,7 @@ apply_handle_update(StringInfo s)
bool has_oldtup;
TupleTableSlot *remoteslot;
RangeTblEntry *target_rte;
+ RTEPermissionInfo *target_perminfo;
MemoryContext oldctx;
/*
@@ -1861,6 +1865,7 @@ apply_handle_update(StringInfo s)
* on the subscriber, since we are not touching those.
*/
target_rte = list_nth(estate->es_range_table, 0);
+ target_perminfo = list_nth(estate->es_rteperminfos, 0);
for (int i = 0; i < remoteslot->tts_tupleDescriptor->natts; i++)
{
Form_pg_attribute att = TupleDescAttr(remoteslot->tts_tupleDescriptor, i);
@@ -1870,14 +1875,14 @@ apply_handle_update(StringInfo s)
{
Assert(remoteattnum < newtup.ncols);
if (newtup.colstatus[remoteattnum] != LOGICALREP_COLUMN_UNCHANGED)
- target_rte->updatedCols =
- bms_add_member(target_rte->updatedCols,
+ target_perminfo->updatedCols =
+ bms_add_member(target_perminfo->updatedCols,
i + 1 - FirstLowInvalidHeapAttributeNumber);
}
}
/* Also populate extraUpdatedCols, in case we have generated columns */
- fill_extraUpdatedCols(target_rte, rel->localrel);
+ fill_extraUpdatedCols(target_rte, target_perminfo, rel->localrel);
/* Build the search tuple. */
oldctx = MemoryContextSwitchTo(GetPerTupleMemoryContext(estate));