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 <[email protected]>
Reported-by: Noah Misch <[email protected]>
Reviewed-by: shveta malik <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 19

Branch
------
REL_19_STABLE

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

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(-)

Reply via email to