Re: DROP SUBSCRIPTION with no slot

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Ziga <ziga(at)ljudmila(dot)org>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DROP SUBSCRIPTION with no slot
Date: 2019-09-24 23:22:03
Message-ID: CAMkU=1wJHO5SiLEQCGf6gWiF93D_dFqM4qZqRGW0VP-mMG8a1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 24, 2019 at 6:42 PM Ziga <ziga(at)ljudmila(dot)org> wrote:

> This also seems to be a problem for somewhat fringe case of subscriptions
> created with connect=false option.
> They cannot be dropped in an obvious way, without knowing the ALTER
> SUBSCRIPTION trick.
>
> For example:
>
> contrib_regression=# create subscription test_sub connection
> 'dbname=contrib_regression' publication test_pub with ( connect=false );
>
>
> WARNING: tables were not subscribed, you will have to run ALTER
> SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
> CREATE SUBSCRIPTION
>
> contrib_regression=# drop subscription test_sub; -- fails
> ERROR: could not drop the replication slot "test_sub" on publisher
> DETAIL: The error was: ERROR: replication slot "test_sub" does not exist
>
> contrib_regression=# alter subscription test_sub set ( slot_name=none );
> ALTER SUBSCRIPTION
>
> contrib_regression=# drop subscription test_sub; -- succeeds
> DROP SUBSCRIPTION
>
>
> Note that the publication was never refreshed.
> It seems that the first DROP should succeed in the above case.
> Or at least some hint should be given how to fix this.
>

There is no HINT in the error message itself, but there is in the
documentation, see note at end of
https://www.postgresql.org/docs/current/sql-dropsubscription.html. I agree
with you that the DROP should just work in this case, even more so than in
my case. But if we go with the argument that doing that is too error
prone, then do we want to include a HINT on how to be error prone more
conveniently?

Cheers,

Jeff

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jamison, Kirk 2019-09-24 23:57:16 RE: [PATCH] Speedup truncates of relation forks
Previous Message Jeff Janes 2019-09-24 23:07:02 Re: DROP SUBSCRIPTION with no slot