postgresql 断开连接时报错

  • Post author:
  • Post category:其他

报错信息:

ERROR: must be a member of the role whose process is being terminated or member of pg_signal_backen

分析及解决:普通用户在执行断开所有连接时,如果有其他用户如系统用户连接着,则没法断开所有连接。

SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE datname=’dbname’ AND pid<>pg_backend_pid();

先断开系统用户的连接,再执行以上断开连接语句


版权声明:本文为rjcs888原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。