postgresql/src
Dean Rasheed 0610b843c9 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
2025-09-04 11:37:46 +01:00
..
backend Fix replica identity check for INSERT ON CONFLICT DO UPDATE. 2025-09-04 11:37:46 +01:00
bin Sort DO_DEFAULT_ACL dump objects independent of OIDs. 2025-08-22 20:50:33 -07:00
common With GB18030, prevent SIGSEGV from reading past end of allocation. 2025-05-05 04:52:08 -07:00
fe_utils In fmtIdEnc(), handle failure of enlargePQExpBuffer(). 2025-02-16 12:46:35 -05:00
include Fix replica identity check for INSERT ON CONFLICT DO UPDATE. 2025-09-04 11:37:46 +01:00
interfaces Translation updates 2025-08-11 14:45:15 +02:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Translation updates 2025-08-11 14:45:15 +02:00
port Make our usage of memset_s() conform strictly to the C11 standard. 2025-05-18 12:45:55 -04:00
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:29:08 -04:00
test Fix replica identity check for INSERT ON CONFLICT DO UPDATE. 2025-09-04 11:37:46 +01:00
timezone Update time zone data files to tzdata release 2025b. 2025-04-30 11:14:19 -04:00
tools Fix MSVC pg_upgrade test. 2025-08-11 12:37:00 -05:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:41 -04:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00