参考:http://blog.csdn.net/wuuushao/article/details/53608180
select * from pg_stat_activity
2.查看结果中是否有procpid 或 pid字段 版本不同造成
3. 利用函数断开连接pg_terminate_backend(procpid/pid)
SELECT pg_terminate_backend(pg_stat_activity.procpid)
FROM pg_stat_activity
WHERE datname='dbname' AND procpid<>pg_backend_pid();
数据库版本查看:select version();
结果一般如下:
Postgresql 8.4.20 on x86_64-redhat-linux-gnu,compiled by GCC gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17),64-bit