Fix" Commands of sync" errors in SQL connector
We had a6b588e7 but this was only solving the case of a trailing ; See merge request !1710
Showing
-
Owner
Is this the correct solution ? How does the overall Zope transaction fail in this setup ? Because it must fail, otherwise this is breaking inter-database consistency.
-
Owner
Yes, it's the same pattern as for
OperationalError
above.allow_reconnect
is alwaysFalse
except in_begin
, so what happens (for both case ofOperationalError
orProgrammingError
) is something like this:- the transaction with wrong SQL fails because
allow_reconnect
is False, so it goes into theelse
branch, this raises, so it will cause the transaction to be aborted at higher level. - the next transaction reuses the connection. It starts with
self._query("BEGIN", allow_reconnect=True)
, this also gets aProgrammingError
, but this timeallow_reconnect
is True so it reconnects and do anotherBEGIN
on the new connection.
- the transaction with wrong SQL fails because
-
Owner
I somehow completely missed the
allow_reconnect
check... Thanks for the explanation, it makes perfect sense now. -
Owner
Great, thanks for checking this
Please register or sign in to comment