Fix the errhint message and docs for drop subscription failure.
authorAmit Kapila <[email protected]>
Wed, 21 Jun 2023 05:06:09 +0000 (10:36 +0530)
committerAmit Kapila <[email protected]>
Wed, 21 Jun 2023 05:06:09 +0000 (10:36 +0530)
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

doc/src/sgml/ref/drop_subscription.sgml
src/backend/commands/subscriptioncmds.c

index 8d997c983fe0d350e1e8862b027bfaa8d486da2a..2a67bdea91310cceff7db14f4dbbda76718bd0b4 100644 (file)
@@ -85,9 +85,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 (and any related table synchronization slots) should then be
index 1c88c2bccbf8d10d65315ed863055883f236cdad..54895ba929a98ad7c5951375d214b351df83c75f 100644 (file)
@@ -2185,7 +2185,8 @@ ReportSlotConnectionError(List *rstates, Oid subid, char *slotname, char *err)
             errmsg("could not connect to publisher when attempting to drop replication slot \"%s\": %s",
                    slotname, 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)")));
 }