Fix the errhint message and docs for drop subscription failure.
authorAmit Kapila
Wed, 21 Jun 2023 04:37:47 +0000 (10:07 +0530)
committerAmit Kapila
Wed, 21 Jun 2023 04:52:07 +0000 (10:22 +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 adbdeafb4e18c222170f8c67b31b41c908a4fe60..65b025c6a60b24d98339e520f9e58b8811a7412f 100644 (file)
@@ -84,9 +84,11 @@ DROP SUBSCRIPTION [ IF EXISTS ] name
    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 DROP SUBSCRIPTION command will fail.  To proceed in
-   this situation, disassociate the subscription from the replication slot by
-   executing ALTER SUBSCRIPTION ... SET (slot_name = NONE).
+   the DROP SUBSCRIPTION command will fail.  To proceed
+   in this situation, first disable the subscription by executing
+   ALTER SUBSCRIPTION ... DISABLE, and then disassociate
+   it from the replication slot by executing
+   ALTER SUBSCRIPTION ... SET (slot_name = NONE).
    After that, DROP SUBSCRIPTION 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
index c99c943a206212030303810745e10871d3c93de1..40356e97ed2e018aba9320501dc4acb56306f26f 100644 (file)
@@ -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();