From 302bbb62801aa193e79bbaa5ac458eafe53160a4 Mon Sep 17 00:00:00 2001 From: TotaJ Date: Mon, 10 Jan 2022 14:12:39 +0800 Subject: [PATCH] Fix update sub partition failed. --- src/gausskernel/runtime/executor/execReplication.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gausskernel/runtime/executor/execReplication.cpp b/src/gausskernel/runtime/executor/execReplication.cpp index 9e70161fd..5b0025de3 100644 --- a/src/gausskernel/runtime/executor/execReplication.cpp +++ b/src/gausskernel/runtime/executor/execReplication.cpp @@ -156,11 +156,13 @@ static bool PartitionFindReplTupleByIndex(EState *estate, Relation rel, Relation ListCell *cell = NULL; foreach (cell, fakeRelInfo->partList) { Partition heapPart = (Partition)lfirst(cell); - Relation partionRel = partitionGetRelation(rel, heapPart); + Relation partionRel = RelationIsSubPartitioned(rel) ? SubPartitionGetRelation(rel, heapPart, NoLock) : + partitionGetRelation(rel, heapPart); /* Get index partition of this heap partition */ Oid idxPartOid = getPartitionIndexOid(RelationGetRelid(idxrel), heapPart->pd_id); Partition idxPart = partitionOpen(idxrel, idxPartOid, RowExclusiveLock); - Relation idxPartRel = partitionGetRelation(idxrel, idxPart); + Relation idxPartRel = RelationIsSubPartitioned(rel) ? SubPartitionGetRelation(idxrel, idxPart, NoLock) : + partitionGetRelation(idxrel, idxPart); fakeRelInfo->partRel = partionRel; fakeRelInfo->part = heapPart; @@ -198,7 +200,8 @@ static bool PartitionFindReplTupleSeq(Relation rel, LockTupleMode lockmode, ListCell *cell = NULL; foreach (cell, fakeRelInfo->partList) { Partition heapPart = (Partition)lfirst(cell); - Relation partionRel = partitionGetRelation(rel, heapPart); + Relation partionRel = RelationIsSubPartitioned(rel) ? SubPartitionGetRelation(rel, heapPart, NoLock) : + partitionGetRelation(rel, heapPart); fakeRelInfo->partRel = partionRel; fakeRelInfo->part = heapPart;