From 7b8d9b75d8a256b164a6d901bdc8119e77eaea5a Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Jun 2023 11:59:35 +1000
Subject: [PATCH] logical_replication_slot_disable_doc_update_v5_REL_13

---
 doc/src/sgml/ref/drop_subscription.sgml | 8 +++++---
 src/backend/commands/subscriptioncmds.c | 3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/doc/src/sgml/ref/drop_subscription.sgml b/doc/src/sgml/ref/drop_subscription.sgml
index adbdeaf..65b025c 100644
--- a/doc/src/sgml/ref/drop_subscription.sgml
+++ b/doc/src/sgml/ref/drop_subscription.sgml
@@ -84,9 +84,11 @@ DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable
    for the subscription on the remote host are released.  If this fails,
    either because the remote host is not reachable or because the remote
    replication slot cannot be dropped or does not exist or never existed,
-   the <command>DROP SUBSCRIPTION</command> command will fail.  To proceed in
-   this situation, disassociate the subscription from the replication slot by
-   executing <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>.
+   the <command>DROP SUBSCRIPTION</command> command will fail.  To proceed
+   in this situation, first disable the subscription by executing
+   <literal>ALTER SUBSCRIPTION ... DISABLE</literal>, and then disassociate
+   it from the replication slot by executing
+   <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>.
    After that, <command>DROP SUBSCRIPTION</command> will no longer attempt any
    actions on a remote host.  Note that if the remote replication slot still
    exists, it should then be dropped manually; otherwise it will continue to
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index c99c943..40356e9 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -992,7 +992,8 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
 						"drop the replication slot \"%s\"", slotname),
 				 errdetail("The error was: %s", err),
 		/* translator: %s is an SQL ALTER command */
-				 errhint("Use %s to disassociate the subscription from the slot.",
+				 errhint("Use %s to disable the subscription, and then use %s to disassociate it from the slot.",
+						 "ALTER SUBSCRIPTION ... DISABLE",
 						 "ALTER SUBSCRIPTION ... SET (slot_name = NONE)")));
 
 	PG_TRY();
-- 
1.8.3.1

