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 <[email protected]>
Reported-by: Noah Misch <[email protected]>
Reviewed-by: Shlok Kyal <[email protected]>
Reviewed-by: Hayato Kuroda (Fujitsu) <[email protected]>
Reviewed-by: Amit Kapila <[email protected]>
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(-)

Reply via email to