Kill a postgresql session/connection

前端 未结 20 1949
暖寄归人
暖寄归人 2020-11-28 00:11

How can I kill all my postgresql connections?

I\'m trying a rake db:drop but I get:

ERROR:  database \"database_name\" is being accessed         


        
20条回答
  •  没有蜡笔的小新
    2020-11-28 00:41

    Remote scenario. But if you're trying to run tests in a rails app, and you get something like

    "ActiveRecord::StatementInvalid: PG::ObjectInUse: ERROR: database "myapp_test" is being accessed by other users DETAIL: There is 1 other session using the database."

    Make sure you close pgAdmin or any other postgres GUI tools before running tests.

提交回复
热议问题