postgresql/src/include
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
..
access Don't ERROR on PreallocXlogFiles() race condition. 2025-04-06 15:27:34 +09:00
bootstrap Update copyrights for 2020 2020-01-01 12:21:45 -05:00
catalog Fix broken handling of domains in atthasmissing logic. 2025-03-03 12:43:29 -05:00
commands doc: Add better description for rewrite functions in event triggers 2024-10-29 15:35:22 +09:00
common Fix corner-case 64-bit integer subtraction bug on some platforms. 2023-11-09 09:56:31 +00:00
datatype Avoid using timezone Asia/Manila in regression tests. 2025-01-20 15:47:53 -05:00
executor Fix replica identity check for INSERT ON CONFLICT DO UPDATE. 2025-09-04 11:37:46 +01:00
fe_utils Specify the encoding of input to fmtId() 2025-02-10 10:03:40 -05:00
foreign Update copyrights for 2020 2020-01-01 12:21:45 -05:00
jit Monkey-patch LLVM code to fix ARM relocation bug. 2024-11-06 23:10:05 +13:00
lib simplehash: Free collisions array in SH_STAT 2024-04-07 19:09:07 -07:00
libpq Make dblink interruptible, via new libpqsrv APIs. 2025-04-03 09:34:02 -07:00
mb With GB18030, prevent SIGSEGV from reading past end of allocation. 2025-05-05 04:52:08 -07:00
nodes Repair commits 317aba70e et al for -DWRITE_READ_PARSE_PLAN_TREES. 2025-03-13 12:13:07 -04:00
optimizer Disallow collecting transition tuples from child foreign tables. 2025-08-08 10:50:05 +09:00
parser Avoid unnecessary plancache revalidation of utility statements. 2023-08-24 12:02:40 -04:00
partitioning Fix hash partition pruning with asymmetric partition sets. 2021-01-28 13:41:55 -05:00
port Fix build breakage on Solaris-alikes with late-model GCC. 2025-07-23 15:44:29 -04:00
portability Update copyrights for 2020 2020-01-01 12:21:45 -05:00
postmaster Fix race condition between shutdown and unstarted background workers. 2020-12-24 17:00:43 -05:00
regex Cope with <regex.h> name clashes. 2024-07-06 10:39:10 +12:00
replication Fix re-distributing previously distributed invalidation messages during logical decoding. 2025-06-16 17:35:48 -07:00
rewrite Fix calculation of which GENERATED columns need to be updated. 2023-01-05 14:12:17 -05:00
snowball Update copyrights for 2020 2020-01-01 12:21:45 -05:00
statistics Initial pgindent and pgperltidy run for v13. 2020-05-14 13:06:50 -04:00
storage Restore smgrtruncate() prototype in back-branches. 2025-01-08 10:48:57 +13:00
tcop Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:20 -07:00
tsearch Add comments and a missing CHECK_FOR_INTERRUPTS in ts_headline. 2022-11-21 17:07:07 -05:00
utils Fix security checks in selectivity estimation functions. 2025-08-11 09:13:20 +01:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Assume that <stdbool.h> conforms to the C standard. 2024-11-25 20:53:21 +13:00
fmgr.h Fix -Wcast-function-type warnings 2024-11-08 09:42:21 +10:30
funcapi.h Avoid holding a directory FD open across assorted SRF calls. 2020-03-16 21:05:52 -04:00
getaddrinfo.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
getopt_long.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
Makefile Get rid of jsonpath_gram.h and jsonpath_scanner.h 2019-03-20 11:13:34 +03:00
miscadmin.h Exclude parallel workers from connection privilege/limit checks. 2024-12-28 16:08:50 -05:00
pg_config.h.in Make our usage of memset_s() conform strictly to the C11 standard. 2025-05-18 12:45:55 -04:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Fix concurrency issues with WAL segment recycling on Windows 2021-03-22 14:02:36 +09:00
pg_getopt.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_trace.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pgstat.h Fix waiting in RegisterSyncRequest(). 2022-03-16 15:37:15 +13:00
pgtar.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pgtime.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
port.h Avoid breaking SJIS encoding while de-backslashing Windows paths. 2025-01-29 14:24:36 -05:00
postgres.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
rusagestub.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
windowapi.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00