pgAdmin doesn't allow deleting a database when there are existing connections present to the database and results in below error.
To overcome the above error, we need to force disconnect all connected users via a query and then try deleting the database.
Once the above query is executed, close the SQL window and then try deleting the database. Closing the SQL window is important as that is considered as one active connection and pgAdmin would still result in the same error, if the window is not closed.
To overcome the above error, we need to force disconnect all connected users via a query and then try deleting the database.
/* Terminate all Database conenctions except current one */SELECT pid, pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = current_database() AND pid <> pg_backend_pid();
Once the above query is executed, close the SQL window and then try deleting the database. Closing the SQL window is important as that is considered as one active connection and pgAdmin would still result in the same error, if the window is not closed.
No comments:
Feel free to leave a piece of your mind.