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
This commit is contained in:
Amit Kapila 2023-06-21 10:07:47 +05:30
parent 2f97105e93
commit 4b4ee1e2b0
2 changed files with 7 additions and 4 deletions

View File

@ -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, for the subscription on the remote host are released. If this fails,
either because the remote host is not reachable or because the remote either because the remote host is not reachable or because the remote
replication slot cannot be dropped or does not exist or never existed, replication slot cannot be dropped or does not exist or never existed,
the <command>DROP SUBSCRIPTION</command> command will fail. To proceed in the <command>DROP SUBSCRIPTION</command> command will fail. To proceed
this situation, disassociate the subscription from the replication slot by in this situation, first disable the subscription by executing
executing <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>. <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 After that, <command>DROP SUBSCRIPTION</command> will no longer attempt any
actions on a remote host. Note that if the remote replication slot still 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 exists, it should then be dropped manually; otherwise it will continue to

View File

@ -992,7 +992,8 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
"drop the replication slot \"%s\"", slotname), "drop the replication slot \"%s\"", slotname),
errdetail("The error was: %s", err), errdetail("The error was: %s", err),
/* translator: %s is an SQL ALTER command */ /* 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)"))); "ALTER SUBSCRIPTION ... SET (slot_name = NONE)")));
PG_TRY(); PG_TRY();