From 5481cc332b0fc8ca242966813a6675a514c6917b Mon Sep 17 00:00:00 2001 From: Dean Rasheed Date: Thu, 4 Sep 2025 11:50:59 +0100 Subject: Fix replica identity check for MERGE. When executing a MERGE, check that the target relation supports all actions mentioned in the MERGE command. Specifically, check that it has a REPLICA IDENTITY if it publishes updates or deletes and the MERGE command contains update or delete actions. Failing to do this can silently break replication. Author: Zhijie Hou Reviewed-by: Ashutosh Bapat Reviewed-by: Dean Rasheed Tested-by: Chao Li Discussion: https://postgr.es/m/OS3PR01MB57180C87E43A679A730482DF94B62@OS3PR01MB5718.jpnprd01.prod.outlook.com Backpatch-through: 15 --- src/backend/executor/execPartition.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/backend/executor/execPartition.c') diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c index 535ae2f09ff..9fb90b32858 100644 --- a/src/backend/executor/execPartition.c +++ b/src/backend/executor/execPartition.c @@ -364,7 +364,8 @@ ExecFindPartition(ModifyTableState *mtstate, /* Verify this ResultRelInfo allows INSERTs */ CheckValidResultRelNew(rri, CMD_INSERT, - node ? node->onConflictAction : ONCONFLICT_NONE); + node ? node->onConflictAction : ONCONFLICT_NONE, + NIL); /* * Initialize information needed to insert this and @@ -531,7 +532,8 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate, * required when the operation is CMD_UPDATE. */ CheckValidResultRelNew(leaf_part_rri, CMD_INSERT, - node ? node->onConflictAction : ONCONFLICT_NONE); + node ? node->onConflictAction : ONCONFLICT_NONE, + NIL); /* * Open partition indices. The user may have asked to check for conflicts -- cgit v1.2.3