pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: vlsi (@vlsi) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #3779: SQLException subclasses support
Date: Wed, 20 Aug 2025 18:48:10 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
The culprit is that `PSQLException extends SQLException`, and we have tons of code that already catch `PSQLException` or cast `Throwable` to `PSQLException`. `PSQLException` predates `SQLRecoverableException`, so I would rather say JDBC spec is not backward-compatible when it comes to `SQLException` subtypes.
Note that a single application might have **multiple** libraries that are either prepared or unprepared to `SQLRecoverableException`.
I've asked ChatGPT, and it did not provide trivial approach to migrating pgjdbc to exception subtypes: https://chatgpt.com/share/68a6162a-8ca4-800f-a0db-a8e5ab0651df
I don't think a connection-wide property like `throw_exceptions_as=psqlexception | psqlexception_subtypes` is not viable as, well, there might be multiple libraries which are either prepared or unprepared to throwable subtypes.
----
I think it might be a nice idea to have a mapper utility which would take `PSQLException` as an input and produce typed exception in return.
It won't be completely portable though.
Do you have any other suggestion?
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] issue #3779: SQLException subclasses support
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox