pgsql: Add error context for sequence synchronization.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add error context for sequence synchronization.
Date: 2026-10-22 05:22:55
Message-ID: E1xJlGR-00000000He2-3uPl@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add error context for sequence synchronization.

An unhandled ERROR while synchronizing a sequence (for example, when
SwitchToUntrustedUser() fails because the subscription owner cannot SET
ROLE to the sequence owner) makes the sequencesync worker exit and be
restarted, repeatedly, until the user resolves the problem, as with the
apply worker. The error message does not identify the sequence or
subscription responsible.

Add an error context callback around per-sequence validation and
synchronization in copy_sequences() so that such errors report the
schema-qualified sequence name and subscription name in CONTEXT.

Reported-by: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Author: Zhijie Hou <houzhijie22(at)gmail(dot)com>
Reviewed-by: Ajin Cherian <itsajin(at)gmail(dot)com>
Reviewed-by: Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(dot)com>
Reviewed-by: vignesh C <vignesh21(at)gmail(dot)com>
Reviewed-by: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Discussion: https://postgr.es/m/CAN4CZFMGiyksxVD1M7cc7_5E+evfi51xmDxw4uqdmvoeH53Ugw@mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/219334a2252729054db98288df64e61b2968f2b7

Modified Files
--------------
src/backend/replication/logical/sequencesync.c | 32 ++++++++++++++++-
src/test/subscription/t/036_sequences.pl | 50 ++++++++++++++++++++++++++
2 files changed, 81 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-10-22 05:39:51 pgsql: Fix argument handling in pg_indexam_progress_phasename()
Previous Message Fujii Masao 2026-10-22 02:01:49 pgsql: psql: Fix tab completion for DROP INDEX CONCURRENTLY