fix: pool test teardown only terminates own connections (not superuser)
All checks were successful
Deploy Plattform-Core / test (push) Successful in 43s
Deploy Plattform-Core / deploy (push) Successful in 4s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ValueOn AG 2026-05-24 03:19:51 +02:00
parent 79ec552264
commit c990dd0317

View file

@ -171,7 +171,8 @@ def liveConnector():
try:
with adminConn.cursor() as cur:
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,),
)
cur.execute(f'DROP DATABASE IF EXISTS "{dbName}"')