agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve DROP SERVER handling of dependent subscriptions.
Date: Mon, 03 Aug 2026 20:29:20 +0000
Message-ID: <E1wqzHk-000000003ey-2EwZ@gemulon.postgresql.org> (raw)

Improve DROP SERVER handling of dependent subscriptions.

We do not allow a DROP SERVER ... CASCADE to implicitly drop a
subscription, because it's in a shared catalog and dropping a
subscription has side effects. Instead we throw an error and the user
must drop the subscription explicitly. Document this behavior and add
a HINT to the error message.

Generalize AcquireDeletionLock()/ReleaseDeletionLock() to use shared
object locks for all shared catalogs, which includes AuthMemRelationId
and now SubscriptionRelationId.

Move error message after AcquireDeletionLock() to avoid an unnecessary
error if there's a concurrent DROP SUBSCRIPTION.

Addresses finding 10 & 15 in report from linked discussion.

Reported-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/20260710195902.4f.noahmisch@microsoft.com
Backpatch-through: 19

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/ref/drop_server.sgml          |  4 ++++
src/backend/catalog/dependency.c           | 31 +++++++++++++++++-------------
src/test/regress/expected/subscription.out |  4 ++++
src/test/regress/sql/subscription.sql      |  2 ++
4 files changed, 28 insertions(+), 13 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1wqzHk-000000003ey-2EwZ@gemulon.postgresql.org>
Permalink:  ../E1wqzHk-000000003ey-2EwZ@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wqzHk-000000003ey-2EwZ@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Improve DROP SERVER handling of dependent subscriptions.
  In-Reply-To: <E1wqzHk-000000003ey-2EwZ@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox