@@ -513,7 +513,7 @@ def _get_reset_query(self):
513
513
_reset_query .append ('ROLLBACK;' )
514
514
if caps .advisory_locks :
515
515
_reset_query .append ('SELECT pg_advisory_unlock_all();' )
516
- if caps .cursors :
516
+ if caps .sql_close_all :
517
517
_reset_query .append ('CLOSE ALL;' )
518
518
if caps .notifications and caps .plpgsql :
519
519
_reset_query .append ('''
@@ -844,30 +844,38 @@ def _create_future(loop):
844
844
845
845
ServerCapabilities = collections .namedtuple (
846
846
'ServerCapabilities' ,
847
- ['advisory_locks' , 'cursors' , 'notifications' , 'plpgsql' , 'sql_reset' ])
847
+ ['advisory_locks' , 'notifications' , 'plpgsql' , 'sql_reset' ,
848
+ 'sql_close_all' ])
848
849
ServerCapabilities .__doc__ = 'PostgreSQL server capabilities.'
849
850
850
851
851
852
def _detect_server_capabilities (server_version , connection_settings ):
852
- if hasattr (connection_settings , 'crdb_version' ):
853
+ if hasattr (connection_settings , 'padb_revision' ):
854
+ # Amazon Redshift detected.
855
+ advisory_locks = False
856
+ notifications = False
857
+ plpgsql = False
858
+ sql_reset = True
859
+ sql_close_all = False
860
+ elif hasattr (connection_settings , 'crdb_version' ):
853
861
# CocroachDB detected.
854
862
advisory_locks = False
855
- cursors = False
856
863
notifications = False
857
864
plpgsql = False
858
865
sql_reset = False
866
+ sql_close_all = False
859
867
else :
860
868
# Standard PostgreSQL server assumed.
861
869
advisory_locks = True
862
- cursors = True
863
870
notifications = True
864
871
plpgsql = True
865
872
sql_reset = True
873
+ sql_close_all = True
866
874
867
875
return ServerCapabilities (
868
876
advisory_locks = advisory_locks ,
869
- cursors = cursors ,
870
877
notifications = notifications ,
871
878
plpgsql = plpgsql ,
872
- sql_reset = sql_reset
879
+ sql_reset = sql_reset ,
880
+ sql_close_all = sql_close_all
873
881
)
0 commit comments