Notes On Postgres

On this Post, I will add my notes while handling some of the issues with Postgres database

Issue-1  ERROR: database “sumitdb” is being accessed by other users

I was trying to delete the database sumitdb, but it was showing below issue,

[2019-11-09 18:53:07] [55006] ERROR: database “sumitdb” is being accessed by other users
[2019-11-09 18:53:07] Detail: There is 1 other session using the database.

Did the following two steps :

Step-1 :

REVOKE CONNECT ON DATABASE sumitdb FROM public;
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'sumitdb';
Step-2 :
drop database notifications

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s