From d11356f444ece3310fb13cd83b4c6df913aca078 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 31 Mar 2021 09:53:35 -0400 Subject: [PATCH] Repair pg8000 disconnect patch For unknown reasons a space character got into the error message being tested in #6099. The fix is entirely non working in 1.4.4. Fixes: #6099 Change-Id: Ib2929be59d62eb2446fc8f040293c9228df7a531 --- doc/build/changelog/unreleased_14/6099.rst | 7 +++++++ lib/sqlalchemy/dialects/postgresql/pg8000.py | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 doc/build/changelog/unreleased_14/6099.rst diff --git a/doc/build/changelog/unreleased_14/6099.rst b/doc/build/changelog/unreleased_14/6099.rst new file mode 100644 index 0000000000..6a5a299e59 --- /dev/null +++ b/doc/build/changelog/unreleased_14/6099.rst @@ -0,0 +1,7 @@ +.. change:: + :tags: bug, postgresql + :tickets: 6099 + + Fixed typo in the fix for :ticket:`6099` released in 1.4.4 that completely + prevented it from working correctly, i.e. the error message did not match + what was actually emitted by pg8000. diff --git a/lib/sqlalchemy/dialects/postgresql/pg8000.py b/lib/sqlalchemy/dialects/postgresql/pg8000.py index cda0bc9415..43df6edea2 100644 --- a/lib/sqlalchemy/dialects/postgresql/pg8000.py +++ b/lib/sqlalchemy/dialects/postgresql/pg8000.py @@ -328,9 +328,9 @@ class PGDialect_pg8000(PGDialect): return ([], opts) def is_disconnect(self, e, connection, cursor): - if isinstance( - e, self.dbapi.InterfaceError - ) and "network error" in str(e): + if isinstance(e, self.dbapi.InterfaceError) and "network error" in str( + e + ): # new as of pg8000 1.19.0 for broken connections return True -- 2.47.2