pgsql: Fix REASSIGN OWNED for subscriptions in other databases.

From: Jeff Davis <jdavis(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix REASSIGN OWNED for subscriptions in other databases.
Date: 2026-07-18 16:27:47
Message-ID: E1wl7tC-000nNc-1k@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix REASSIGN OWNED for subscriptions in other databases.

Subscription objects are conceptually database-local objects, but
pg_subscription is a shared catalog so that the launcher process can
scan it.

Check readers of pg_subscription to ensure that, unless it's the
launcher process, it filters by MyDatabaseId. Most readers were
already doing so, but this commit fixes REASSIGN OWNED and adds guards
to catch other problems in the future. Also, clarify documentation.

Author: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Reported-by: Noah Misch <noah(at)leadboat(dot)com>
Reviewed-by: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Discussion: https://postgr.es/m/20260710192533.4f.noahmisch@microsoft.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/03bcb6a7778e3eaa148c98107d878e2bd9b8a27b

Modified Files
--------------
contrib/postgres_fdw/t/010_subscription.pl | 45 ++++++++++++++++++++++++++++++
doc/src/sgml/ref/reassign_owned.sgml | 5 +++-
doc/src/sgml/user-manag.sgml | 4 ++-
src/backend/catalog/pg_subscription.c | 12 ++++++++
src/backend/commands/subscriptioncmds.c | 14 +++++++++-
5 files changed, 77 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2026-07-18 16:27:53 pgsql: Fix REASSIGN OWNED for subscriptions in other databases.
Previous Message Amit Kapila 2026-07-18 02:33:55 pgsql: Revert "Reject concurrent sequence refreshes".