@@ -531,7 +531,7 @@ def _get_reset_query(self):
531531 _reset_query .append ('ROLLBACK;' )
532532 if caps .advisory_locks :
533533 _reset_query .append ('SELECT pg_advisory_unlock_all();' )
534- if caps .cursors :
534+ if caps .sql_close_all :
535535 _reset_query .append ('CLOSE ALL;' )
536536 if caps .notifications and caps .plpgsql :
537537 _reset_query .append ('''
@@ -884,30 +884,38 @@ def _create_future(loop):
884884
885885ServerCapabilities = collections .namedtuple (
886886 'ServerCapabilities' ,
887- ['advisory_locks' , 'cursors' , 'notifications' , 'plpgsql' , 'sql_reset' ])
887+ ['advisory_locks' , 'notifications' , 'plpgsql' , 'sql_reset' ,
888+ 'sql_close_all' ])
888889ServerCapabilities .__doc__ = 'PostgreSQL server capabilities.'
889890
890891
891892def _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' ):
893901 # CocroachDB detected.
894902 advisory_locks = False
895- cursors = False
896903 notifications = False
897904 plpgsql = False
898905 sql_reset = False
906+ sql_close_all = False
899907 else :
900908 # Standard PostgreSQL server assumed.
901909 advisory_locks = True
902- cursors = True
903910 notifications = True
904911 plpgsql = True
905912 sql_reset = True
913+ sql_close_all = True
906914
907915 return ServerCapabilities (
908916 advisory_locks = advisory_locks ,
909- cursors = cursors ,
910917 notifications = notifications ,
911918 plpgsql = plpgsql ,
912- sql_reset = sql_reset
919+ sql_reset = sql_reset ,
920+ sql_close_all = sql_close_all
913921 )
0 commit comments