fix: pool test teardown only terminates own connections (not superuser)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
79ec552264
commit
c990dd0317
1 changed files with 2 additions and 1 deletions
|
|
@ -171,7 +171,8 @@ def liveConnector():
|
||||||
try:
|
try:
|
||||||
with adminConn.cursor() as cur:
|
with adminConn.cursor() as cur:
|
||||||
cur.execute(
|
cur.execute(
|
||||||
'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = %s',
|
'SELECT pg_terminate_backend(pid) FROM pg_stat_activity '
|
||||||
|
'WHERE datname = %s AND pid != pg_backend_pid() AND usename = current_user',
|
||||||
(dbName,),
|
(dbName,),
|
||||||
)
|
)
|
||||||
cur.execute(f'DROP DATABASE IF EXISTS "{dbName}"')
|
cur.execute(f'DROP DATABASE IF EXISTS "{dbName}"')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue