]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
handle asyncpg InternalClientError main
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 17 Apr 2026 20:13:53 +0000 (16:13 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 17 Apr 2026 20:13:53 +0000 (16:13 -0400)
Fixed issue where the asyncpg driver could throw an insufficiently-handled
exception ``InternalClientError`` under some circumstances, leading to
connections not being properly marked as invalidated.

Fixes: #13241
References: https://github.com/MagicStack/asyncpg/issues/1069
Change-Id: Iaaf551b3d7b062cce62e13b441161583a484615f

doc/build/changelog/unreleased_20/13241.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/postgresql/asyncpg.py

diff --git a/doc/build/changelog/unreleased_20/13241.rst b/doc/build/changelog/unreleased_20/13241.rst
new file mode 100644 (file)
index 0000000..3b12945
--- /dev/null
@@ -0,0 +1,9 @@
+.. change::
+    :tags: bug, postgresql
+    :tickets: 13241
+
+    Fixed issue where the asyncpg driver could throw an insufficiently-handled
+    exception ``InternalClientError`` under some circumstances, leading to
+    connections not being properly marked as invalidated.
+
+
index 9bf20c6c827034df65fb08fc51ef0cfaf1f45816..33aa9a9de925f742e79a4b7e27d1425ebc82ec04 100644 (file)
@@ -1030,6 +1030,9 @@ class AsyncAdapt_asyncpg_dbapi(AsyncAdapt_dbapi_module):
     class InternalServerError(InternalError):
         pass
 
+    class InternalClientError(InternalError):
+        pass
+
     class InvalidCachedStatementError(NotSupportedError):
         def __init__(self, message, error=None):
             super().__init__(
@@ -1060,6 +1063,7 @@ class AsyncAdapt_asyncpg_dbapi(AsyncAdapt_dbapi_module):
             asyncpg.exceptions.UniqueViolationError: self.UniqueViolationError,
             asyncpg.exceptions.CheckViolationError: self.CheckViolationError,
             asyncpg.exceptions.ExclusionViolationError: self.ExclusionViolationError,  # noqa: E501
+            asyncpg.exceptions.InternalClientError: self.InternalClientError,
         }
 
     def Binary(self, value):