diff --git a/trytond/backend/postgresql/database.py b/trytond/backend/postgresql/database.py index 2d3cc1d3a0..8ce13947b8 100644 --- a/trytond/backend/postgresql/database.py +++ b/trytond/backend/postgresql/database.py @@ -185,7 +185,10 @@ class Database(DatabaseInterface): cursor2 = database.cursor() if cursor2.test(): res.append(db_name) - cursor2.close(close=True) + cursor2.close(close=True) + else: + cursor2.close(close=True) + database.close() return res @staticmethod