Skip to content

Commit 651af5d

Browse files
committed
Modify the way ExecMergeMatched() detects moved partitions
Use tupleid for ROW_REF_TID as in upsteam. Use &context->tmfd.ctid for ROW_REF_ROWID as in OrioleDB.
1 parent 1f4a79a commit 651af5d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/backend/executor/nodeModifyTable.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2832,6 +2832,7 @@ ExecMergeMatched(ModifyTableContext *context, ResultRelInfo *resultRelInfo,
28322832
{
28332833
Relation resultRelationDesc;
28342834
TupleTableSlot *epqslot;
2835+
ItemPointer movedPartitionCheckCtid;
28352836

28362837
/*
28372838
* The target tuple was concurrently updated by some other
@@ -2857,7 +2858,11 @@ ExecMergeMatched(ModifyTableContext *context, ResultRelInfo *resultRelInfo,
28572858
* the tuple moved, and setting our current
28582859
* resultRelInfo to that.
28592860
*/
2860-
if (ItemPointerIndicatesMovedPartitions(&context->tmfd.ctid))
2861+
if (resultRelInfo->ri_RowRefType == ROW_REF_TID)
2862+
movedPartitionCheckCtid = (ItemPointer) tupleid;
2863+
else
2864+
movedPartitionCheckCtid = &context->tmfd.ctid;
2865+
if (ItemPointerIndicatesMovedPartitions(movedPartitionCheckCtid))
28612866
ereport(ERROR,
28622867
(errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
28632868
errmsg("tuple to be merged was already moved to another partition due to concurrent update")));

0 commit comments

Comments
 (0)