[HACKERS] Better error message for trying to drop a DB with open subscriptions? - Mailing list pgsql-hackers

From Josh Berkus
Subject [HACKERS] Better error message for trying to drop a DB with open subscriptions?
Date
Msg-id e6df8484-2b22-084c-7412-e7c1427e608b@berkus.org
Whole thread Raw
Responses Re: [HACKERS] Better error message for trying to drop a DB with open subscriptions?
Re: [HACKERS] Better error message for trying to drop a DB with open subscriptions?
List pgsql-hackers
All:

The problem:

postgres=# drop database bookdata;
ERROR:  database "bookdata" is being accessed by other users
DETAIL:  There is 1 other session using the database.
postgres=# \c bookdata
You are now connected to database "bookdata" as user "postgres".
bookdata=# drop subscription wholedb;
NOTICE:  dropped replication slot "wholedb" on publisher
DROP SUBSCRIPTION
bookdata=# \c postgres
You are now connected to database "postgres" as user "postgres".
postgres=# drop database bookdata;
DROP DATABASE

Is there any easy way for us to detect that the "user" accessing the
target database is actually a logical replication subscription, and give
the DBA a better error message (e.g. "database 'bookdata' still has open
subscrptions")?

-- 
Josh Berkus
Containers & Databases Oh My!



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: [HACKERS] <> join selectivity estimate question
Next
From: Tatsuo Ishii
Date:
Subject: [HACKERS] More optimization effort?