postgresql/src/include
Amit Kapila 73eba5004a Detect and Log multiple_unique_conflicts type conflict.
Introduce a new conflict type, multiple_unique_conflicts, to handle cases
where an incoming row during logical replication violates multiple UNIQUE
constraints.

Previously, the apply worker detected and reported only the first
encountered key conflict (insert_exists/update_exists), causing repeated
failures as each constraint violation needs to be handled one by one
making the process slow and error-prone.

With this patch, the apply worker checks all unique constraints upfront
once the first key conflict is detected and reports
multiple_unique_conflicts if multiple violations exist. This allows users
to resolve all conflicts at once by deleting all conflicting tuples rather
than dealing with them individually or skipping the transaction.

In the future, this will also allow us to specify different resolution
handlers for such a conflict type.

Add the stats for this conflict type in pg_stat_subscription_stats.

Author: Nisha Moond <nisha.moond412@gmail.com>
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Discussion: https://postgr.es/m/CABdArM7FW-_dnthGkg2s0fy1HhUB8C3ELA0gZX1kkbs1ZZoV3Q@mail.gmail.com
2025-03-24 12:30:44 +05:30
..
access Improve nbtree array primitive scan scheduling. 2025-03-22 13:02:18 -04:00
archive Update copyright for 2025 2025-01-01 11:21:55 -05:00
backup Update copyright for 2025 2025-01-01 11:21:55 -05:00
bootstrap pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
catalog Detect and Log multiple_unique_conflicts type conflict. 2025-03-24 12:30:44 +05:30
commands Add an additional hook for EXPLAIN option validation. 2025-03-20 13:47:55 -04:00
common Fix headerscheck warning. 2025-03-18 08:37:07 -07:00
datatype Avoid using timezone Asia/Manila in regression tests. 2025-01-20 15:47:53 -05:00
executor Ensure first ModifyTable rel initialized if all are pruned 2025-03-19 12:14:24 +09:00
fe_utils pg_rewind: Add dbname to primary_conninfo when using --write-recovery-conf. 2025-03-12 16:56:04 -07:00
foreign Update copyright for 2025 2025-01-01 11:21:55 -05:00
jit Fix grammatical typos around possessive "its" 2025-01-29 14:39:14 +07:00
lib Add new StringInfo APIs to allow callers to specify the buffer size. 2025-01-11 08:23:46 +09:00
libpq backend libpq void * argument for binary data 2025-02-23 14:27:02 +01:00
mb pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
nodes Allow plugins to set a 64-bit plan identifier in PlannedStmt 2025-03-24 13:23:42 +09:00
optimizer Expand virtual generated columns in the planner 2025-02-25 16:10:25 +09:00
parser pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
partitioning Fix incorrect #endif comment 2025-03-10 13:36:04 +13:00
pch Update copyright for 2025 2025-01-01 11:21:55 -05:00
port Increase io_combine_limit range to 1MB. 2025-03-19 15:40:35 +13:00
portability Update copyright for 2025 2025-01-01 11:21:55 -05:00
postmaster pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
regex Update copyright for 2025 2025-01-01 11:21:55 -05:00
replication Detect and Log multiple_unique_conflicts type conflict. 2025-03-24 12:30:44 +05:30
rewrite Eliminate code duplication in replace_rte_variables callbacks 2025-02-25 16:11:34 +09:00
snowball Update to latest Snowball sources. 2025-02-18 21:13:54 -05:00
statistics Remove redundant pg_set_*_stats() variants. 2025-02-25 16:15:47 -08:00
storage aio: Change prefix of PgAioResultStatus values to PGAIO_RS_ 2025-03-22 17:30:44 -04:00
tcop pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
tsearch Update copyright for 2025 2025-01-01 11:21:55 -05:00
utils Allow plugins to set a 64-bit plan identifier in PlannedStmt 2025-03-24 13:23:42 +09:00
.gitignore Use <stdint.h> and <inttypes.h> for c.h integers. 2024-12-04 15:05:38 +13:00
c.h Swap order of extern/static and pg_nodiscard 2025-03-14 07:18:07 +01:00
fmgr.h extension_control_path 2025-03-19 07:03:20 +01:00
funcapi.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
getopt_long.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
Makefile Use <stdint.h> and <inttypes.h> for c.h integers. 2024-12-04 15:05:38 +13:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
miscadmin.h aio: Infrastructure for io_method=worker 2025-03-18 11:54:01 -04:00
pg_config.h.in Add support for OAUTHBEARER SASL mechanism 2025-02-20 16:25:17 +01:00
pg_config_manual.h Avoid invalidating all RelationSyncCache entries on publication rename. 2025-03-13 09:16:33 +05:30
pg_getopt.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
pg_trace.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
pgstat.h aio: Infrastructure for io_method=worker 2025-03-18 11:54:01 -04:00
pgtar.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
pgtime.h Seek zone abbreviations in the IANA data before timezone_abbreviations. 2025-01-16 14:11:19 -05:00
port.h Avoid breaking SJIS encoding while de-backslashing Windows paths. 2025-01-29 14:24:36 -05:00
postgres.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
postgres_ext.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
postgres_fe.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
varatt.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
windowapi.h Update copyright for 2025 2025-01-01 11:21:55 -05:00