Re: DROP SUBSCRIPTION with no slot

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: DROP SUBSCRIPTION with no slot
Дата
Msg-id CAMkU=1wJHO5SiLEQCGf6gWiF93D_dFqM4qZqRGW0VP-mMG8a1Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: DROP SUBSCRIPTION with no slot  (Ziga <ziga@ljudmila.org>)
Ответы Re: DROP SUBSCRIPTION with no slot  (Žiga Kranjec <ziga@ljudmila.org>)
Список pgsql-hackers
On Tue, Sep 24, 2019 at 6:42 PM Ziga <ziga@ljudmila.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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: DROP SUBSCRIPTION with no slot
Следующее
От: "Jamison, Kirk"
Дата:
Сообщение: RE: [PATCH] Speedup truncates of relation forks