A small bug with the new psycopg 3 backend has reared its head in production, apparently sqlstate can be None for certain rare client side exceptions (e.g. server closed connection unexpectedly), so the following check needs to be modified in order to be completely safe:
A small bug with the new psycopg 3 backend has reared its head in production, apparently
sqlstate
can beNone
for certain rare client side exceptions (e.g. server closed connection unexpectedly), so the following check needs to be modified in order to be completely safe:https://github.com/zopefoundation/zope.sqlalchemy/blob/758572997a128a25658385655e45d6e6de963f10/src/zope/sqlalchemy/datamanager.py#L48
The
lambda
should be changed to:lambda e: e.sqlstate and e.sqlstate.startswith('40'))
@icemac Considering this is such a small change I hope you can just quickly do it yourself, thanks!