v1-0001-draft-of-fix.patch

text/plain

Filename: v1-0001-draft-of-fix.patch
Type: text/plain
Part: 2
Message: Assert when executing query on partitioned table
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index b0fe50075ad..4b0ae8bd32c 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -2792,7 +2792,10 @@ ExecOnConflictUpdate(ModifyTableContext *context,
 			 * be lock is moved to another partition due to concurrent update
 			 * of the partition key.
 			 */
-			Assert(!ItemPointerIndicatesMovedPartitions(&tmfd.ctid));
+			if (ItemPointerIndicatesMovedPartitions(&tmfd.ctid))
+				ereport(ERROR,
+						(errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
+						 errmsg("tuple to be updated was already moved to another partition due to concurrent update")));
 
 			/*
 			 * Tell caller to try again from the very start.