[PostgreSQL] drop database

UPDATE pg_database SET datallowconn = 'false' WHERE datname = 'mydb';

SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'mydb';

DROP DATABASE mydb;

Leave a Reply

Your email address will not be published. Required fields are marked *