1
2
3
SELECT * FROM pg_stat_activity WHERE datname = '<database_name>';
SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '<database_name>';
DROP DATABASE '<database_name>'