I’m writing retry logic for handling various exceptions that can arise interacting with PostgreSQL using JDBC. I want to retry for some exceptions but not for others, based on the SQL state (error code) of the exception. According to the docs there is an error code 08007 | transaction_resolution_unknown
. That sounds like something I would potentially not want to do a retry on.
I searched the PostgreSQL and pgjdbc source code expecting to find out what circumstances could give rise to the error code 08007 | transaction_resolution_unknown
, but found none.
So my question is can this error actually arise?
2
Answers
I’d say that you don’t have to introduce any special handling for this error code, because it is defined, but not used at all by the current PostgreSQL source. The error may be in the list only because it is defined by the SQL standard.
To clarify a previous answer, taking advantage of the fact that PostgreSQL is an open source project we could clone it (current version) locally
and verify the use of that error code in the source code itself, a common error code 08006 ERRCODE_CONNECTION_FAILURE appears multiple times in source
but 08007 ERRCODE_TRANSACTION_RESOLUTION_UNKNOWN by name or by code only appears in documentation files and one header file
So could be concluded that is not used, only documented in compliance with the SQL standard.