pgsql: Fix misreporting of publisher sequence permissions during sync

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix misreporting of publisher sequence permissions during sync
Date: 2026-06-20 09:23:20
Message-ID: E1warv6-0017V2-1b@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix misreporting of publisher sequence permissions during sync

When synchronizing sequences for logical replication, a
publisher-side permission failure could be reported as if the sequence
were missing on the publisher, making the real cause harder to
identify.

This happened because pg_get_sequence_data() returns a row of NULL
values when the replication connection lacks permission to read a
sequence. Sequence synchronization treated that the same as a missing
sequence, causing it to emit a misleading "missing sequence on
publisher" warning.

Fix this by distinguishing permission failures from genuinely missing
sequences. The synchronization query now checks whether the
replication connection has the required privilege for each published
sequence, allowing the worker to report permission failures
separately.

Author: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Reviewed-by: Tristan Partin <tristan(at)partin(dot)io>
Discussion: https://postgr.es/m/CAHGQGwGNTaXnBKUV510_P1KwhdbHT+kgZ4zU5njBHy7nCqdhzg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d4a657b0a4db72ca3fe1a02e851f776276a8d8a1

Modified Files
--------------
src/backend/replication/logical/sequencesync.c | 95 ++++++++++++++++++--------
src/test/subscription/t/036_sequences.pl | 22 +++++-
2 files changed, 86 insertions(+), 31 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2026-06-21 19:08:35 pgsql: plpython: Use funccache.c infrastructure for procedure caching.
Previous Message Michael Paquier 2026-06-20 07:29:45 pgsql: Make type cache initialization more resilient on re-entry after