I'm trying to delete a database. I've restart Postgresql service:
sudo systemctl stop postgresql
sudo systemctl start postgresql
And yet:
# drop database my_db1;
ERROR: database "my_db1" is being accessed by other users
Why is that and how to delete it?
This isn't working either:
select pg_terminate_backend(pg_stat_activity.pid)
from pg_stat_activity
where pg_stat_activity.datname = 'my_db1' and pid <> pg_backend_pid();
because active connections still exist after I've run it;