pgsql: Always check foreign-server USAGE when resolving subscription co

From: Jeff Davis <jdavis(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Always check foreign-server USAGE when resolving subscription co
Date: 2026-08-05 20:26:31
Message-ID: E1wriC7-00000000LHG-05rb@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Always check foreign-server USAGE when resolving subscription conninfo.

Previously, this was skipped in some cases to avoid raising errors
when conninfo wasn't even needed. That was wrong in cases where
conninfo was needed.

Now that we only build conninfo when needed, always perform the USAGE
check.

Addresses finding 7 in report from linked discussion.

Co-authored-by: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
Reported-by: Noah Misch <noah(at)leadboat(dot)com>
Reviewed-by: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
Reviewed-by: Hayato Kuroda (Fujitsu) <kuroda(dot)hayato(at)fujitsu(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Discussion: https://postgr.es/m/20260710195902.4f.noahmisch%40microsoft.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5ba18183c4ca34beeedf7023d1f260ba1f5e9f87

Modified Files
--------------
src/backend/catalog/pg_subscription.c | 23 ++++++++++-------------
src/backend/commands/subscriptioncmds.c | 9 +--------
src/backend/replication/logical/worker.c | 4 ++--
src/include/catalog/pg_subscription.h | 2 +-
src/test/regress/expected/subscription.out | 3 +++
src/test/regress/sql/subscription.sql | 3 +++
6 files changed, 20 insertions(+), 24 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-08-05 23:19:40 pgsql: Remove redundant unlink() in KeepFileRestoredFromArchive() for n
Previous Message Jeff Davis 2026-08-05 20:26:27 pgsql: Revert "Validate subscription conninfo on owner change"