File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1267,9 +1267,9 @@ def terminate(self):
1267
1267
1268
1268
async def reset (self , * , timeout = None ):
1269
1269
self ._check_open ()
1270
+ reset_query = self ._get_reset_query ()
1270
1271
self ._listeners .clear ()
1271
1272
self ._log_listeners .clear ()
1272
- reset_query = self ._get_reset_query ()
1273
1273
1274
1274
if self ._protocol .is_in_transaction () or self ._top_xact is not None :
1275
1275
if self ._top_xact is None or not self ._top_xact ._managed :
@@ -1476,7 +1476,11 @@ def _get_reset_query(self):
1476
1476
_reset_query .append ('SELECT pg_advisory_unlock_all();' )
1477
1477
if caps .sql_close_all :
1478
1478
_reset_query .append ('CLOSE ALL;' )
1479
- if caps .notifications and caps .plpgsql :
1479
+ if (
1480
+ caps .notifications and
1481
+ caps .plpgsql and
1482
+ len (self ._listeners .keys ()) != 0
1483
+ ):
1480
1484
_reset_query .append ('''
1481
1485
DO $$
1482
1486
BEGIN
You can’t perform that action at this time.
0 commit comments