@@ -531,7 +531,7 @@ def _get_reset_query(self):
531
531
_reset_query .append ('ROLLBACK;' )
532
532
if caps .advisory_locks :
533
533
_reset_query .append ('SELECT pg_advisory_unlock_all();' )
534
- if caps .cursors :
534
+ if caps .sql_close_all :
535
535
_reset_query .append ('CLOSE ALL;' )
536
536
if caps .notifications and caps .plpgsql :
537
537
_reset_query .append ('''
@@ -884,30 +884,38 @@ def _create_future(loop):
884
884
885
885
ServerCapabilities = collections .namedtuple (
886
886
'ServerCapabilities' ,
887
- ['advisory_locks' , 'cursors' , 'notifications' , 'plpgsql' , 'sql_reset' ])
887
+ ['advisory_locks' , 'notifications' , 'plpgsql' , 'sql_reset' ,
888
+ 'sql_close_all' ])
888
889
ServerCapabilities .__doc__ = 'PostgreSQL server capabilities.'
889
890
890
891
891
892
def _detect_server_capabilities (server_version , connection_settings ):
892
- if hasattr (connection_settings , 'crdb_version' ):
893
+ if hasattr (connection_settings , 'padb_revision' ):
894
+ # Amazon Redshift detected.
895
+ advisory_locks = False
896
+ notifications = False
897
+ plpgsql = False
898
+ sql_reset = True
899
+ sql_close_all = False
900
+ elif hasattr (connection_settings , 'crdb_version' ):
893
901
# CocroachDB detected.
894
902
advisory_locks = False
895
- cursors = False
896
903
notifications = False
897
904
plpgsql = False
898
905
sql_reset = False
906
+ sql_close_all = False
899
907
else :
900
908
# Standard PostgreSQL server assumed.
901
909
advisory_locks = True
902
- cursors = True
903
910
notifications = True
904
911
plpgsql = True
905
912
sql_reset = True
913
+ sql_close_all = True
906
914
907
915
return ServerCapabilities (
908
916
advisory_locks = advisory_locks ,
909
- cursors = cursors ,
910
917
notifications = notifications ,
911
918
plpgsql = plpgsql ,
912
- sql_reset = sql_reset
919
+ sql_reset = sql_reset ,
920
+ sql_close_all = sql_close_all
913
921
)
0 commit comments