Fix doc of DROP SUBSCRIPTION

Started by Yugo Nagataover 8 years ago4 messages
#1Yugo Nagata
nagata@sraoss.co.jp
1 attachment(s)

Hi,

The documentation says that a subscription that has a replication slot
cannot be dropped in a transaction block, but it is not allowed even
outside of a transaction block. Attached is a patch to fix it.

Regards,

--
Yugo Nagata <nagata@sraoss.co.jp>

Attachments:

drop_subscription.patchtext/x-diff; name=drop_subscription.patchDownload
diff --git a/doc/src/sgml/ref/drop_subscription.sgml b/doc/src/sgml/ref/drop_subscription.sgml
index f535c00..bb48578 100644
--- a/doc/src/sgml/ref/drop_subscription.sgml
+++ b/doc/src/sgml/ref/drop_subscription.sgml
@@ -38,10 +38,9 @@ DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable
   </para>
 
   <para>
-   <command>DROP SUBSCRIPTION</command> cannot be executed inside a
-   transaction block if the subscription is associated with a replication
-   slot.  (You can use <command>ALTER SUBSCRIPTION</command> to unset the
-   slot.)
+   <command>DROP SUBSCRIPTION</command> cannot be executed if the subscription
+   is associated with a replication slot.  (You can use <command>ALTER
+   SUBSCRIPTION</command> to unset the slot.)
   </para>
  </refsect1>
 
#2Masahiko Sawada
sawada.mshk@gmail.com
In reply to: Yugo Nagata (#1)
Re: Fix doc of DROP SUBSCRIPTION

On Fri, Jun 30, 2017 at 7:01 PM, Yugo Nagata <nagata@sraoss.co.jp> wrote:

Hi,

The documentation says that a subscription that has a replication slot
cannot be dropped in a transaction block, but it is not allowed even
outside of a transaction block.

Hmm, I think we can drop a subscription outside of a transaction block
even if the subscription associates with a replication.

=# table pg_subscription;
subdbid | subname | subowner | subenabled | subconninfo
| subslotname | subsynccommit | subpublications
---------+----------+----------+------------+---------------------------+-------------+---------------+-----------------
13164 | hoge_sub | 10 | t | dbname=postgres
port=5550 | hoge_sub | off | {one_pub}
(1 row)

=# drop subscription hoge_sub ;
DROP SUBSCRIPTION

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Yugo Nagata
nagata@sraoss.co.jp
In reply to: Masahiko Sawada (#2)
Re: Fix doc of DROP SUBSCRIPTION

On Fri, 30 Jun 2017 20:17:39 +0900
Masahiko Sawada <sawada.mshk@gmail.com> wrote:

On Fri, Jun 30, 2017 at 7:01 PM, Yugo Nagata <nagata@sraoss.co.jp> wrote:

Hi,

The documentation says that a subscription that has a replication slot
cannot be dropped in a transaction block, but it is not allowed even
outside of a transaction block.

Hmm, I think we can drop a subscription outside of a transaction block
even if the subscription associates with a replication.

Sorry, I was wrong and missing something... I confirmaed it.
The documentation is right. Sorry for the noise.

=# table pg_subscription;
subdbid | subname | subowner | subenabled | subconninfo
| subslotname | subsynccommit | subpublications
---------+----------+----------+------------+---------------------------+-------------+---------------+-----------------
13164 | hoge_sub | 10 | t | dbname=postgres
port=5550 | hoge_sub | off | {one_pub}
(1 row)

=# drop subscription hoge_sub ;
DROP SUBSCRIPTION

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

--
Yugo Nagata <nagata@sraoss.co.jp>

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Petr Jelinek
petr.jelinek@2ndquadrant.com
In reply to: Yugo Nagata (#3)
Re: Fix doc of DROP SUBSCRIPTION

On 30/06/17 15:17, Yugo Nagata wrote:

On Fri, 30 Jun 2017 20:17:39 +0900
Masahiko Sawada <sawada.mshk@gmail.com> wrote:

On Fri, Jun 30, 2017 at 7:01 PM, Yugo Nagata <nagata@sraoss.co.jp> wrote:

Hi,

The documentation says that a subscription that has a replication slot
cannot be dropped in a transaction block, but it is not allowed even
outside of a transaction block.

Hmm, I think we can drop a subscription outside of a transaction block
even if the subscription associates with a replication.

Sorry, I was wrong and missing something... I confirmaed it.
The documentation is right. Sorry for the noise.

It will only fail if the remote site is not reachable during the drop
(but then it should hint about the ALTER), maybe that's what happened to
you?

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers