[DOC] Update ALTER SUBSCRIPTION documentation
Hi,
We have recently used the PostgreSQL documentation when setting up our
logical replication. We noticed there was a step missing in the
documentation on how to drop a logical replication subscription with a
replication slot attached.
We clarify the documentation to include prerequisites for running the
DROP SUBSCRIPTION command. Please see attached patch.
Best regards,
Robert Sjöblom,
Oscar Carlberg
--
Innehållet i detta e-postmeddelande är konfidentiellt och avsett endast för
adressaten.Varje spridning, kopiering eller utnyttjande av innehållet är
förbjuden utan tillåtelse av avsändaren. Om detta meddelande av misstag
gått till fel adressat vänligen radera det ursprungliga meddelandet och
underrätta avsändaren via e-post
Attachments:
v1-doc-update-replication-slot-disable.patchtext/x-patch; charset=UTF-8; name=v1-doc-update-replication-slot-disable.patchDownload
diff --git a/doc/src/sgml/ref/drop_subscription.sgml b/doc/src/sgml/ref/drop_subscription.sgml
index 8d997c983f..81b3051070 100644
--- a/doc/src/sgml/ref/drop_subscription.sgml
+++ b/doc/src/sgml/ref/drop_subscription.sgml
@@ -86,8 +86,10 @@ DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable
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>.
+ this situation, first disable the subscription with
+ <literal>ALTER SUBSCRIPTION ... DISABLE</literal>. Then disassociate the
+ subscription 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
Import Notes
Reply to msg id not found: 983fb847-fbd6-08d2-8199-1056cad43c6c@fortnox.seReference msg id not found: 983fb847-fbd6-08d2-8199-1056cad43c6c@fortnox.se
On Fri, May 5, 2023 at 6:47 PM Robert Sjöblom <robert.sjoblom@fortnox.se> wrote:
We have recently used the PostgreSQL documentation when setting up our
logical replication. We noticed there was a step missing in the
documentation on how to drop a logical replication subscription with a
replication slot attached.We clarify the documentation to include prerequisites for running the
DROP SUBSCRIPTION command. Please see attached patch.
Shouldn't we also change the following errhint in the code as well?
ReportSlotConnectionError()
{
...
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
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.",
"ALTER SUBSCRIPTION ... SET (slot_name = NONE)")));
...
}
--
With Regards,
Amit Kapila.
On Fri, May 5, 2023 at 11:17 PM Robert Sjöblom
<robert.sjoblom@fortnox.se> wrote:
Hi,
We have recently used the PostgreSQL documentation when setting up our
logical replication. We noticed there was a step missing in the
documentation on how to drop a logical replication subscription with a
replication slot attached.We clarify the documentation to include prerequisites for running the
DROP SUBSCRIPTION command. Please see attached patch.
Right, there is a "missing step" in the documentation, but OTOH that
step is going to be obvious from the error you get when attempting to
set the slot_name to NONE:
e.g.
test_sub=# ALTER SUBSCRIPTION sub1 SET (slot_name= NONE);
ERROR: cannot set slot_name = NONE for enabled subscription
~
IMO this scenario is sort of a trade-off between (a) wanting to give
every little step explicitly versus (b) trying to keep the
documentation free of clutter.
I think a comprise here is just to mention the need for disabling the
subscription but without spelling out the details of the ALTER ...
DISABLE command.
For example,
BEFORE
To proceed in this situation, disassociate the subscription from the
replication slot by executing ALTER SUBSCRIPTION ... SET (slot_name =
NONE).
SUGGESTION
To proceed in this situation, first DISABLE the subscription, and then
disassociate it from the replication slot by executing ALTER
SUBSCRIPTION ... SET (slot_name = NONE).
------
Kind Regards,
Peter Smith.
Fujitsu Australia
On Mon, May 8, 2023 at 12:07 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
On Fri, May 5, 2023 at 6:47 PM Robert Sjöblom <robert.sjoblom@fortnox.se> wrote:
We have recently used the PostgreSQL documentation when setting up our
logical replication. We noticed there was a step missing in the
documentation on how to drop a logical replication subscription with a
replication slot attached.We clarify the documentation to include prerequisites for running the
DROP SUBSCRIPTION command. Please see attached patch.Shouldn't we also change the following errhint in the code as well?
ReportSlotConnectionError()
{
...
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
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.",
"ALTER SUBSCRIPTION ... SET (slot_name = NONE)")));
...
}
Yeah, if the subscription is enabled, it might be helpful for users if
the error hint message says something like:
Use ALTER SUBSCRIPTION ... SET (slot_name = NONE) to disassociate the
subscription from the slot after disabling the subscription.
Apart from the documentation change, given that setting slot_name =
NONE always requires for the subscription to be disabled beforehand,
does it make sense to change ALTER SUBSCRIPTION SET so that we disable
the subscription when setting slot_name = NONE? Setting slot_name to a
valid slot name doesn't enable the subscription, though.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
On Mon, May 8, 2023 at 1:51 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
Apart from the documentation change, given that setting slot_name =
NONE always requires for the subscription to be disabled beforehand,
does it make sense to change ALTER SUBSCRIPTION SET so that we disable
the subscription when setting slot_name = NONE? Setting slot_name to a
valid slot name doesn't enable the subscription, though.
I think this is worth considering. Offhand, I don't see any problem
with this idea but users may not like the automatic disabling of
subscriptions along with setting slot_name=NONE. It would be better to
discuss this in a separate thread to seek the opinion of others.
--
With Regards,
Amit Kapila.
On Tue, May 9, 2023 at 3:40 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
On Mon, May 8, 2023 at 1:51 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
Apart from the documentation change, given that setting slot_name =
NONE always requires for the subscription to be disabled beforehand,
does it make sense to change ALTER SUBSCRIPTION SET so that we disable
the subscription when setting slot_name = NONE? Setting slot_name to a
valid slot name doesn't enable the subscription, though.I think this is worth considering. Offhand, I don't see any problem
with this idea but users may not like the automatic disabling of
subscriptions along with setting slot_name=NONE. It would be better to
discuss this in a separate thread to seek the opinion of others.
Agreed.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
On 2023-05-05 15:17, Robert Sjöblom wrote:
Hi,
We have recently used the PostgreSQL documentation when setting up our
logical replication. We noticed there was a step missing in the
documentation on how to drop a logical replication subscription with a
replication slot attached.
Following discussions, please see revised documentation patch.
Best regards,
Robert Sjöblom
--
Innehållet i detta e-postmeddelande är konfidentiellt och avsett endast för
adressaten.Varje spridning, kopiering eller utnyttjande av innehållet är
förbjuden utan tillåtelse av avsändaren. Om detta meddelande av misstag
gått till fel adressat vänligen radera det ursprungliga meddelandet och
underrätta avsändaren via e-post
Attachments:
logical_replication_slot_disable_doc_update.patchtext/x-patch; charset=UTF-8; name=logical_replication_slot_disable_doc_update.patchDownload
diff --git a/doc/src/sgml/ref/drop_subscription.sgml b/doc/src/sgml/ref/drop_subscription.sgml
index 8d997c983f..4be6ddb873 100644
--- a/doc/src/sgml/ref/drop_subscription.sgml
+++ b/doc/src/sgml/ref/drop_subscription.sgml
@@ -86,8 +86,9 @@ DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable
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>.
+ this situation, first <literal>DISABLE</literal> the subscription, 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
On Mon, May 15, 2023 at 11:36 PM Robert Sjöblom
<robert.sjoblom@fortnox.se> wrote:
On 2023-05-05 15:17, Robert Sjöblom wrote:
Hi,
We have recently used the PostgreSQL documentation when setting up our
logical replication. We noticed there was a step missing in the
documentation on how to drop a logical replication subscription with a
replication slot attached.Following discussions, please see revised documentation patch.
LGTM.
BTW, in the previous thread, there was also a suggestion from Amit [1]/messages/by-id/CAA4eK1J11phiaoCOmsjNqPZ9BOWyLXYrfgrm5vU2uCFPF2kN1Q@mail.gmail.com
to change the errhint in a similar way. There was no reply to Amit's
idea, so it's not clear whether it's an accidental omission from your
v2 patch or not.
------
[1]: /messages/by-id/CAA4eK1J11phiaoCOmsjNqPZ9BOWyLXYrfgrm5vU2uCFPF2kN1Q@mail.gmail.com
Kind Regards,
Peter Smith.
Fujitsu Australia
Den tis 16 maj 2023 kl 01:44 skrev Peter Smith <smithpb2250@gmail.com>:
On Mon, May 15, 2023 at 11:36 PM Robert Sjöblom
<robert.sjoblom@fortnox.se> wrote:On 2023-05-05 15:17, Robert Sjöblom wrote:
Hi,
We have recently used the PostgreSQL documentation when setting up our
logical replication. We noticed there was a step missing in the
documentation on how to drop a logical replication subscription with a
replication slot attached.Following discussions, please see revised documentation patch.
LGTM.
BTW, in the previous thread, there was also a suggestion from Amit [1]
to change the errhint in a similar way. There was no reply to Amit's
idea, so it's not clear whether it's an accidental omission from your
v2 patch or not.------
[1] /messages/by-id/CAA4eK1J11phiaoCOmsjNqPZ9BOWyLXYrfgrm5vU2uCFPF2kN1Q@mail.gmail.comKind Regards,
Peter Smith.
Fujitsu Australia
Accidental omission by way of mail client, I suppose -- some messages
got flagged as spam and moved to another folder. I went ahead with
Masahiko Sawada's suggestion for the error message; see revised patch.
Best regards,
Robert Sjöblom
--
Innehållet i detta e-postmeddelande är konfidentiellt och avsett endast för
adressaten.Varje spridning, kopiering eller utnyttjande av innehållet är
förbjuden utan tillåtelse av avsändaren. Om detta meddelande av misstag
gått till fel adressat vänligen radera det ursprungliga meddelandet och
underrätta avsändaren via e-post
Attachments:
logical_replication_slot_disable_doc_update_v3.patchapplication/x-patch; name=logical_replication_slot_disable_doc_update_v3.patchDownload
diff --git a/doc/src/sgml/ref/drop_subscription.sgml b/doc/src/sgml/ref/drop_subscription.sgml
index 8d997c983f..4be6ddb873 100644
--- a/doc/src/sgml/ref/drop_subscription.sgml
+++ b/doc/src/sgml/ref/drop_subscription.sgml
@@ -86,8 +86,9 @@ DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable
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>.
+ this situation, first <literal>DISABLE</literal> the subscription, 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
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index e8b288d01c..9ecb91ab15 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -2185,7 +2185,7 @@ 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 disassociate the subscription from the slot after disabling the subscription.",
"ALTER SUBSCRIPTION ... SET (slot_name = NONE)")));
}
+ errhint("Use %s to disassociate the subscription from the slot after
disabling the subscription.",
IMO it looked strange having the word "subscription" 2x in the same sentence.
Maybe you can reword the errhint like:
BEFORE
"Use %s to disassociate the subscription from the slot after disabling
the subscription."
SUGGESTION#1
"Disable the subscription, then use %s to disassociate it from the slot."
SUGGESTION#2
"After disabling the subscription use %s to disassociate it from the slot."
~~~
BTW, it is a bit difficult to follow this thread because the subject
keeps changing.
------
Kind Regards,
Peter Smith.
Fujitsu Australia
Den ons 17 maj 2023 kl 03:18 skrev Peter Smith <smithpb2250@gmail.com>:
+ errhint("Use %s to disassociate the subscription from the slot after
disabling the subscription.",IMO it looked strange having the word "subscription" 2x in the same sentence.
Maybe you can reword the errhint like:
BEFORE
"Use %s to disassociate the subscription from the slot after disabling
the subscription."SUGGESTION#1
"Disable the subscription, then use %s to disassociate it from the slot."SUGGESTION#2
"After disabling the subscription use %s to disassociate it from the slot."~~~
BTW, it is a bit difficult to follow this thread because the subject
keeps changing.------
Kind Regards,
Peter Smith.
Fujitsu Australia
Good catch, I definitely agree. I'm sorry about changing the subject
line, I'm unaccustomed to mailing lists -- I'll leave it as it is now.
Attached is the revised version.
Best regards,
Robert Sjöblom
--
Innehållet i detta e-postmeddelande är konfidentiellt och avsett endast för
adressaten.Varje spridning, kopiering eller utnyttjande av innehållet är
förbjuden utan tillåtelse av avsändaren. Om detta meddelande av misstag
gått till fel adressat vänligen radera det ursprungliga meddelandet och
underrätta avsändaren via e-post
Attachments:
logical_replication_slot_disable_doc_update_v4.patchtext/x-patch; charset=US-ASCII; name=logical_replication_slot_disable_doc_update_v4.patchDownload
diff --git a/doc/src/sgml/ref/drop_subscription.sgml b/doc/src/sgml/ref/drop_subscription.sgml
index 8d997c983f..4be6ddb873 100644
--- a/doc/src/sgml/ref/drop_subscription.sgml
+++ b/doc/src/sgml/ref/drop_subscription.sgml
@@ -86,8 +86,9 @@ DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable
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>.
+ this situation, first <literal>DISABLE</literal> the subscription, 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
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index e8b288d01c..c0373e5fad 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -2185,7 +2185,7 @@ 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("Disable the subscription, then use %s to disassociate it from the slot.",
"ALTER SUBSCRIPTION ... SET (slot_name = NONE)")));
}
On Wed, May 17, 2023 at 2:53 PM Robert Sjöblom
<robert.sjoblom@fortnox.se> wrote:
Den ons 17 maj 2023 kl 03:18 skrev Peter Smith <smithpb2250@gmail.com>:
+ errhint("Use %s to disassociate the subscription from the slot after
disabling the subscription.",IMO it looked strange having the word "subscription" 2x in the same sentence.
Maybe you can reword the errhint like:
BEFORE
"Use %s to disassociate the subscription from the slot after disabling
the subscription."SUGGESTION#1
"Disable the subscription, then use %s to disassociate it from the slot."SUGGESTION#2
"After disabling the subscription use %s to disassociate it from the slot."~~~
BTW, it is a bit difficult to follow this thread because the subject
keeps changing.------
Kind Regards,
Peter Smith.
Fujitsu AustraliaGood catch, I definitely agree. I'm sorry about changing the subject
line, I'm unaccustomed to mailing lists -- I'll leave it as it is now.Attached is the revised version.
v4 looks good to me.
------
Kind Regards,
Peter Smith.
Fujitsu Australia
On Wed, May 17, 2023 at 11:57 AM Peter Smith <smithpb2250@gmail.com> wrote:
On Wed, May 17, 2023 at 2:53 PM Robert Sjöblom
<robert.sjoblom@fortnox.se> wrote:Attached is the revised version.
v4 looks good to me.
The latest version looks good to me as well. I think we should
backpatch this change as this is a user-facing message change in docs
and code. What do you guys think?
--
With Regards,
Amit Kapila.
On Wed, Jun 14, 2023 at 1:10 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
On Wed, May 17, 2023 at 11:57 AM Peter Smith <smithpb2250@gmail.com> wrote:
On Wed, May 17, 2023 at 2:53 PM Robert Sjöblom
<robert.sjoblom@fortnox.se> wrote:Attached is the revised version.
v4 looks good to me.
The latest version looks good to me as well. I think we should
backpatch this change as this is a user-facing message change in docs
and code. What do you guys think?
I do not know the exact criteria for deciding to back-patch, but I am
not sure back-patching is so important for this one.
It is not a critical bug-fix, and despite being a user-facing change,
there is no functional change. Also, IIUC the previous docs existed
for 6 years without problem.
------
Kind Regards,
Peter Smith.
Fujitsu Australia
On Wed, Jun 14, 2023 at 9:25 AM Peter Smith <smithpb2250@gmail.com> wrote:
On Wed, Jun 14, 2023 at 1:10 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
On Wed, May 17, 2023 at 11:57 AM Peter Smith <smithpb2250@gmail.com> wrote:
On Wed, May 17, 2023 at 2:53 PM Robert Sjöblom
<robert.sjoblom@fortnox.se> wrote:Attached is the revised version.
v4 looks good to me.
The latest version looks good to me as well. I think we should
backpatch this change as this is a user-facing message change in docs
and code. What do you guys think?I do not know the exact criteria for deciding to back-patch, but I am
not sure back-patching is so important for this one.It is not a critical bug-fix, and despite being a user-facing change,
there is no functional change.
Right neither this is a functional change nor a critical but where any
work will be stopped due to this but I think we do prefer to backpatch
changes (doc) where user-facing docs have an additional explanation.
For example, see [1]https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=e126d817c7af989c47366b0e344ee83d761f334a[2]https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=f170b572d2b4cc232c5b6d391b4ecf3e368594b7. OTOH, there is an argument that we should do
this only in v17 but I guess this is a simple improvement that will be
helpful for even current users, so it is better to change this in
existing branches as well.
[1]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=e126d817c7af989c47366b0e344ee83d761f334a
[2]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=f170b572d2b4cc232c5b6d391b4ecf3e368594b7
--
With Regards,
Amit Kapila.
Hi:
postgres ODBC's driver psqlodbcw.so supports Unicode. You can do this by checking the value of the SQL_ATTR_ANSI_APP attribute; if it is SQL_AA_FALSE, Unicode is supported; If the value is SQL_AA_TRUE, ANSI is supported
At 2023-06-14 11:54:46, "Peter Smith" <smithpb2250@gmail.com> wrote:
Show quoted text
On Wed, Jun 14, 2023 at 1:10 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
On Wed, May 17, 2023 at 11:57 AM Peter Smith <smithpb2250@gmail.com> wrote:
On Wed, May 17, 2023 at 2:53 PM Robert Sjöblom
<robert.sjoblom@fortnox.se> wrote:Attached is the revised version.
v4 looks good to me.
The latest version looks good to me as well. I think we should
backpatch this change as this is a user-facing message change in docs
and code. What do you guys think?I do not know the exact criteria for deciding to back-patch, but I am
not sure back-patching is so important for this one.It is not a critical bug-fix, and despite being a user-facing change,
there is no functional change. Also, IIUC the previous docs existed
for 6 years without problem.------
Kind Regards,
Peter Smith.
Fujitsu Australia
On 14.06.23 05:09, Amit Kapila wrote:
The latest version looks good to me as well. I think we should
backpatch this change as this is a user-facing message change in docs
and code. What do you guys think?
Isn't that a reason *not* to backpatch it?
On Wed, Jun 14, 2023 at 6:52 PM Peter Eisentraut <peter@eisentraut.org> wrote:
On 14.06.23 05:09, Amit Kapila wrote:
The latest version looks good to me as well. I think we should
backpatch this change as this is a user-facing message change in docs
and code. What do you guys think?Isn't that a reason *not* to backpatch it?
I wanted to backpatch the following change which provides somewhat
accurate information about what a user needs to do when it faces an
error.
To proceed in
- this situation, disassociate the subscription from the replication slot by
- executing <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>.
+ this situation, first <literal>DISABLE</literal> the subscription, and then
+ disassociate it from the replication slot by executing
+ <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>.
Now, along with this change, there is a change in errhint as well
which I am not sure about whether to backpatch or not. I think we have
the following options (a) commit both doc and code change in HEAD (b)
commit both doc and code change in v17 when the next version branch
opens (c) backpatch the doc change and commit the code change in HEAD
only (d) backpatch the doc change and commit the code change in v17
(e) backpatch both the doc and code change.
What do you think?
--
With Regards,
Amit Kapila.
On 15.06.23 04:49, Amit Kapila wrote:
I wanted to backpatch the following change which provides somewhat accurate information about what a user needs to do when it faces an error. To proceed in - this situation, disassociate the subscription from the replication slot by - executing <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>. + this situation, first <literal>DISABLE</literal> the subscription, and then + disassociate it from the replication slot by executing + <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>.Now, along with this change, there is a change in errhint as well
which I am not sure about whether to backpatch or not. I think we have
the following options (a) commit both doc and code change in HEAD (b)
commit both doc and code change in v17 when the next version branch
opens (c) backpatch the doc change and commit the code change in HEAD
only (d) backpatch the doc change and commit the code change in v17
(e) backpatch both the doc and code change.
Reading the thread again now, I think this is essentially a bug fix, so
I don't mind backpatching it.
I wish the errhint would show the actual command to disable the
subscription. It already shows the command to detach the replication
slot, so it would only be consistent to also show the other command.
On Fri, Jun 16, 2023 at 7:15 PM Peter Eisentraut <peter@eisentraut.org> wrote:
On 15.06.23 04:49, Amit Kapila wrote:
Now, along with this change, there is a change in errhint as well
which I am not sure about whether to backpatch or not. I think we have
the following options (a) commit both doc and code change in HEAD (b)
commit both doc and code change in v17 when the next version branch
opens (c) backpatch the doc change and commit the code change in HEAD
only (d) backpatch the doc change and commit the code change in v17
(e) backpatch both the doc and code change.Reading the thread again now, I think this is essentially a bug fix, so
I don't mind backpatching it.I wish the errhint would show the actual command to disable the
subscription. It already shows the command to detach the replication
slot, so it would only be consistent to also show the other command.
Fair enough. I updated the errhint and slightly adjusted the docs as
well in the attached.
--
With Regards,
Amit Kapila.
Attachments:
logical_replication_slot_disable_doc_update_v5.patchapplication/octet-stream; name=logical_replication_slot_disable_doc_update_v5.patchDownload
diff --git a/doc/src/sgml/ref/drop_subscription.sgml b/doc/src/sgml/ref/drop_subscription.sgml
index 8d997c983f..2a67bdea91 100644
--- a/doc/src/sgml/ref/drop_subscription.sgml
+++ b/doc/src/sgml/ref/drop_subscription.sgml
@@ -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
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 1c88c2bccb..54895ba929 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -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)")));
}
FYI - I have created and tested back-patches for Amit's v5 patch,
going all the way to REL_10_STABLE.
(the patches needed tweaking several times due to minor code/docs
differences in the earlier versions)
PSA.
------
Kind Regards,
Peter Smith.
Fujitsu Australia
Attachments:
logical_replication_slot_disable_doc_update_v5_REL_12.patchapplication/octet-stream; name=logical_replication_slot_disable_doc_update_v5_REL_12.patchDownload
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
logical_replication_slot_disable_doc_update_v5_REL_11.patchapplication/octet-stream; name=logical_replication_slot_disable_doc_update_v5_REL_11.patchDownload
From e8c2ebf77c8b18765227242c8b1300fc6c44e16e Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Jun 2023 13:05:31 +1000
Subject: [PATCH] logical_replication_slot_disable_doc_update_v5_REL_11
---
doc/src/sgml/ref/drop_subscription.sgml | 8 +++++---
src/backend/commands/subscriptioncmds.c | 6 ++++--
2 files changed, 9 insertions(+), 5 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 7c98121..b03a987 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -975,8 +975,10 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
(errmsg("could not connect to publisher when attempting to "
"drop the replication slot \"%s\"", slotname),
errdetail("The error was: %s", err),
- errhint("Use ALTER SUBSCRIPTION ... SET (slot_name = NONE) "
- "to disassociate the subscription from the slot.")));
+ /* translator: %s is an SQL ALTER command */
+ 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
logical_replication_slot_disable_doc_update_v5_HEAD.patchapplication/octet-stream; name=logical_replication_slot_disable_doc_update_v5_HEAD.patchDownload
diff --git a/doc/src/sgml/ref/drop_subscription.sgml b/doc/src/sgml/ref/drop_subscription.sgml
index 8d997c983f..2a67bdea91 100644
--- a/doc/src/sgml/ref/drop_subscription.sgml
+++ b/doc/src/sgml/ref/drop_subscription.sgml
@@ -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
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 1c88c2bccb..54895ba929 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -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)")));
}
logical_replication_slot_disable_doc_update_v5_REL_13.patchapplication/octet-stream; name=logical_replication_slot_disable_doc_update_v5_REL_13.patchDownload
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
logical_replication_slot_disable_doc_update_v5_REL_10.patchapplication/octet-stream; name=logical_replication_slot_disable_doc_update_v5_REL_10.patchDownload
From e8c2ebf77c8b18765227242c8b1300fc6c44e16e Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Jun 2023 13:05:31 +1000
Subject: [PATCH] logical_replication_slot_disable_doc_update_v5_REL_11
---
doc/src/sgml/ref/drop_subscription.sgml | 8 +++++---
src/backend/commands/subscriptioncmds.c | 6 ++++--
2 files changed, 9 insertions(+), 5 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 7c98121..b03a987 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -975,8 +975,10 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
(errmsg("could not connect to publisher when attempting to "
"drop the replication slot \"%s\"", slotname),
errdetail("The error was: %s", err),
- errhint("Use ALTER SUBSCRIPTION ... SET (slot_name = NONE) "
- "to disassociate the subscription from the slot.")));
+ /* translator: %s is an SQL ALTER command */
+ 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
logical_replication_slot_disable_doc_update_v5_REL_15.patchapplication/octet-stream; name=logical_replication_slot_disable_doc_update_v5_REL_15.patchDownload
diff --git a/doc/src/sgml/ref/drop_subscription.sgml b/doc/src/sgml/ref/drop_subscription.sgml
index 8d997c983f..2a67bdea91 100644
--- a/doc/src/sgml/ref/drop_subscription.sgml
+++ b/doc/src/sgml/ref/drop_subscription.sgml
@@ -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
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 1c88c2bccb..54895ba929 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -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)")));
}
logical_replication_slot_disable_doc_update_v5_REL_14.patchapplication/octet-stream; name=logical_replication_slot_disable_doc_update_v5_REL_14.patchDownload
From 50d78a60142522f9a38b540d737b7e92d928d8bf Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Jun 2023 11:22:30 +1000
Subject: [PATCH] logical_replication_slot_disable_doc_update_v5_REL_14
---
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 aee9615..d79f137 100644
--- a/doc/src/sgml/ref/drop_subscription.sgml
+++ b/doc/src/sgml/ref/drop_subscription.sgml
@@ -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
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 1719f04..b1a2f3f 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -1578,7 +1578,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)")));
}
--
1.8.3.1
On Tue, Jun 20, 2023 at 9:02 AM Peter Smith <smithpb2250@gmail.com> wrote:
FYI - I have created and tested back-patches for Amit's v5 patch,
going all the way to REL_10_STABLE.
Pushed. I haven't used PG10 patch as REL_10_STABLE is out of support now.
--
With Regards,
Amit Kapila.