Skip to content

Commit 0e73b9a

Browse files
author
Amit Kapila
committed
Fix the errhint message and docs for drop subscription failure.
The existing errhint message and docs were missing the fact that we can't disassociate from the slot unless the subscription is disabled. Author: Robert Sjöblom, Peter Smith Reviewed-by: Peter Eisentraut, Amit Kapila Backpatch-through: 11 Discussion: https://postgr.es/m/807bdf85-61ea-88e2-5712-6d9fcd4eabff@fortnox.se
1 parent 9529b1e commit 0e73b9a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

doc/src/sgml/ref/drop_subscription.sgml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable
8484
for the subscription on the remote host are released. If this fails,
8585
either because the remote host is not reachable or because the remote
8686
replication slot cannot be dropped or does not exist or never existed,
87-
the <command>DROP SUBSCRIPTION</command> command will fail. To proceed in
88-
this situation, disassociate the subscription from the replication slot by
89-
executing <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>.
87+
the <command>DROP SUBSCRIPTION</command> command will fail. To proceed
88+
in this situation, first disable the subscription by executing
89+
<literal>ALTER SUBSCRIPTION ... DISABLE</literal>, and then disassociate
90+
it from the replication slot by executing
91+
<literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>.
9092
After that, <command>DROP SUBSCRIPTION</command> will no longer attempt any
9193
actions on a remote host. Note that if the remote replication slot still
9294
exists, it should then be dropped manually; otherwise it will continue to

src/backend/commands/subscriptioncmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,8 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
10051005
"drop the replication slot \"%s\"", slotname),
10061006
errdetail("The error was: %s", err),
10071007
/* translator: %s is an SQL ALTER command */
1008-
errhint("Use %s to disassociate the subscription from the slot.",
1008+
errhint("Use %s to disable the subscription, and then use %s to disassociate it from the slot.",
1009+
"ALTER SUBSCRIPTION ... DISABLE",
10091010
"ALTER SUBSCRIPTION ... SET (slot_name = NONE)")));
10101011

10111012
PG_TRY();

0 commit comments

Comments
 (0)