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: Avoid errors during DROP SUBSCRIPTION when slot_name is NONE.
Date: Thu, 18 Jun 2026 16:21:07 +0000
Message-ID: <E1waFUI-000tI0-36@gemulon.postgresql.org> (raw)

Avoid errors during DROP SUBSCRIPTION when slot_name is NONE.

Previously, if the subscription used a server,
ForeignServerConnectionString() could raise an error (e.g. missing
user mapping) during DROP SUBSCRIPTION even if the conninfo wasn't
needed at all.

Construct conninfo after the early return, so that if slot_name is
NONE and rstates is NIL, the DROP SUBSCRIPTION will succeed even if
ForeignServerConnectionString() raises an error (e.g. missing user
mapping).

If slot_name is NONE and rstates is not NIL, DROP SUBSCRIPTION may
still encounter an error from ForeignServerConnectionString().

Reported-by: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/OS9PR01MB12149B54DEA148108C6FA5667F52D2@OS9PR01MB12149.jpnprd01.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/702e9dfd6c5001fd64d51c3c47dca2fc953fa9cd

Modified Files
--------------
src/backend/commands/subscriptioncmds.c    | 85 ++++++++++++++++++------------
src/test/regress/expected/subscription.out |  5 +-
src/test/regress/sql/subscription.sql      |  5 +-
3 files changed, 56 insertions(+), 39 deletions(-)



Message-ID: <E1waFUI-000tI0-36@gemulon.postgresql.org>
Permalink:  ../E1waFUI-000tI0-36@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1waFUI-000tI0-36@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: Avoid errors during DROP SUBSCRIPTION when slot_name is NONE.
  In-Reply-To: <E1waFUI-000tI0-36@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