use postgres;标签:stat,删除,数据库,pid,PGSQL,testdb,pg,activity,backend From: https://blog.51cto.com/u_14650780/5998659
DROP DATABASE testdb;
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE datname='testdb' AND pid<>pg_backend_pid();
三条语句一起上,不好意思上面的语句写反了
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE datname='tids_submit_data_line' AND pid<>pg_backend_pid(); DROP DATABASE tids_submit_data_line;