Thread: Bug in psqlODBC 9.3.4: Wrong SQL state when connection is lost
Bug in psqlODBC 9.3.4: Wrong SQL state when connection is lost
Hello.
Under certain conditions, I receive a nonsense SQL state 23505 (‘unique_violation’) when a connection is lost (where the connection loss is simply enforced by a shutdown of the PostgreSQL service for the purpose of testing this issue). The SQL state is used by the application in order to determine whether or not the connection should be discarded or reused for subsequent database activity, and a connection where a ‘unique_violation’ occurred is generally assumed to be in good state in terms of connectivity. No reconnect attempt is being made, yet the connection is of course not usable any more due to the connection loss. From that point, it yields that same bogus error upon every attempt to perform something.
I have attached two logs from different environments.
In “mylog_1308.log”, everything behaves as expected and reports an SQL state “08S01” upon connection loss which clearly identifies the problem as a connectivity issue and makes the application decide to try to reconnect later.
The other file (“mylog_4956.log”) shows that an SQL state 23505 is sometimes reported where the actual error is “Could not send Query to backend” which is far from a ‘unique_violation’ issue.
Both log files have been manually patched such that my password is not shown as plain text. Apart from that, they are unmodified.
Environment:
- Client: PostgreSQL Unicode ODBC Driver version 9.3.4, 32Bit
- Database: PostgreSQL 9.3.5, Windows, 64Bit
Please help. Thanks.
With kind regards,
Bernd Watermann