summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorDean Rasheed <dean.a.rasheed@gmail.com>2025-09-04 11:35:19 +0100
committerDean Rasheed <dean.a.rasheed@gmail.com>2025-09-04 11:35:19 +0100
commit451b22efd9ac4a1014af8add5405d809d92ff590 (patch)
tree527bcb1f564a0444f183e4e33d19ba045ab61330 /src/include
parent53e35fb560abe1e32dd3a831acde8bfdb34a6a70 (diff)
Fix replica identity check for INSERT ON CONFLICT DO UPDATE.
If an INSERT has an ON CONFLICT DO UPDATE clause, the executor must check that the target relation supports UPDATE as well as INSERT. In particular, it must check that the target relation has a REPLICA IDENTITY if it publishes updates. Formerly, it was not doing this check, which could lead to silently breaking replication. Fix by adding such a check to CheckValidResultRel(), which requires adding a new onConflictAction argument. In back-branches, preserve ABI compatibility by introducing a wrapper function with the original signature. Author: Zhijie Hou <houzj.fnst@fujitsu.com> Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com> Tested-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/OS3PR01MB57180C87E43A679A730482DF94B62@OS3PR01MB5718.jpnprd01.prod.outlook.com Backpatch-through: 13
Diffstat (limited to 'src/include')
-rw-r--r--src/include/executor/executor.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index 96604d7647c..fe5910cf79c 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -198,6 +198,8 @@ extern void standard_ExecutorEnd(QueryDesc *queryDesc);
extern void ExecutorRewind(QueryDesc *queryDesc);
extern bool ExecCheckRTPerms(List *rangeTable, bool ereport_on_violation);
extern bool ExecCheckRTEPerms(RangeTblEntry *rte);
+extern void CheckValidResultRelNew(ResultRelInfo *resultRelInfo, CmdType operation,
+ OnConflictAction onConflictAction);
extern void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation);
extern void InitResultRelInfo(ResultRelInfo *resultRelInfo,
Relation resultRelationDesc,