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:27
Message-ID: E1wriC3-00000000LG8-3cb9@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
------
master

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

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 Jeff Davis 2026-08-05 20:26:31 pgsql: Always check foreign-server USAGE when resolving subscription co
Previous Message Jeff Davis 2026-08-05 20:14:10 pgsql: Be precise about when ALTER SUBSCRIPTION needs conninfo.