New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PgServerException #1904
base: master
Are you sure you want to change the base?
PgServerException #1904
Conversation
What is this fixing ? |
Is a draft to fix #963, it's a breaking change as I said in the comment of that issue, just to show how to implement exception hierarchy and also improve (IMHO) how to throw a server exception and also include a complete set of SQL status code from PostgreSQL. This is how to get the server exception here: try (Statement stmt = con.createStatement()) {
stmt.executeQuery("select foo()");
fail("function foo() does not exist");
} catch (SQLSyntaxErrorException sqle) {
if (sqle.getCause() instanceof PgServerException) {
PgServerException pgex = (PgServerException) sqle.getCause();
String message = pgex.getMessage();
String sqlstatus = pgex.getSQLState();
String formatedMessage = pgex.toString();
String hint = pgex.getHint();
int pos = pgex.getPosition();
}
} If this is of interest I could keep working on this as time allows me, if not, we can just close it. |
So I think this is OK to continue working on for 42.3.x |
Sorry I haven't found time to work on this. If the intention is to make 42.3.x a breaking change, then this should definitely need to go on 43.3.0 as a breaking change, to make this less invasive the original exceptions could be deprecated instead of removed, but that doesn't make sense since there are not used anymore and would silently be ignored by clients. Is there any deadline for pushing this to 42.3? I mean, I also want some feedback if this is worth it. |
There is no deadline per-se, however I would like to get it pushed as we are now supporting two branches and I would rather only support one |
This certainly is not passive, but it is a great improvement to be able to use the sql exception hierarchy. |
Is this still under consideration? It would be very helpful to be able to access the JDBC exception hierarchy instead of having to use |
Well clearly it would need to be rebased. @jorsol are you able to work on this ? |
Please note that currently, this will be a breaking change for those that use or depend on PSQLException, maybe this weekend I could probably find some time to rebase this, but it should not be taken lightly... probably I can make it less "breaking" by deprecating PSQLException first, yet some tools/apps that use that will still need to be updated. |
Good point! We can add a property to throw the new exception and then eventually deprecate that? |
Well, that's a good idea, a property might do the trick, yet I have been a bit busy so, please give me a couple of months to work on this. |
All Submissions:
New Feature Submissions:
./gradlew autostyleCheck checkstyleAll
pass ?Changes to Existing Features: