Modified the ``is_disconnect()`` handler for the pg8000 dialect, which now
accommodates for a new ``InterfaceError`` emitted by pg8000 1.19.0. Pull
request courtesy Hamdi Burak Usul.
Fixes: #6099
Closes: #6150
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6150
Pull-request-sha:
cd58836d3e19489d5203c02f7cc5f2f2d7c82a20
Change-Id: Ief942e53f6d90c48e8d77c70948fd46eb6c90dbd
--- /dev/null
+.. change::
+ :tags: bug, postgresql
+ :tickets: 6099
+
+ Modified the ``is_disconnect()`` handler for the pg8000 dialect, which now
+ accommodates for a new ``InterfaceError`` emitted by pg8000 1.19.0. Pull
+ request courtesy Hamdi Burak Usul.
+
return ([], opts)
def is_disconnect(self, e, connection, cursor):
+ if isinstance(
+ e, self.dbapi.InterfaceError
+ ) and "network error" in str(e):
+ # new as of pg8000 1.19.0 for broken connections
+ return True
+
+ # connection was closed normally
return "connection is closed" in str(e)
def set_isolation_level(self, connection, level):