I noticed a bug where psqlodbc doesn't handle an underlying error correctly.
The interaction is roughly as follows:
Initiate a connection, run few queries, run `ss -K dport postgresql` to kill the psqlodbc connection to postgres, then run another query.
The expected behaviour is for query to fail and to return an error like "08S01".
Instead, the following error is generated: ``` pgapi30.c[PGAPI_GetDiagRec]43: entering type=3 rec=1 environ.c[ER_ReturnError]202: entering status = 1, msg = #no connection to the server... environ.c[ER_ReturnError]259: szSqlState = 'HY000',len=58, szError='no connection to the server ```
This makes it a bit tricky to properly handle the exception on the client.
I'm browsing through this code base for the first time, and the incomplete error handling seems to be around these lines in connection.c
I think this need a call to `CC_on_abort(self, CONN_DEAD);` in order to clean up the connection so that future calls would get trapped by `SC_connection_lost_check` call which also propagates the correct error to `SQLGetDiagRec` with a statement handle.