pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: rmagnin-efluid (@rmagnin-efluid) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3558: Add SQLState to PSQLException default message
Date: Wed, 05 Mar 2025 13:28:25 +0000
Message-ID: <[email protected]> (raw)
The default message of a `PSQLException` contains some information from the `ServerErrorMessage` but not the SQLState :
```
ERROR: syntax error at or near "xxx"
Position : 39
```
But not the SQLState, which can be useful to quickly diagnose an error or to analyze logs by some tools.
Its appearance is conditionned in `ServerErrorMessage#toString()` by the log level, which has to be `FINEST` :
```
@Override
public String toString() {
// ...
if (LOGGER.isLoggable(Level.FINEST)) {
// ...
message = mesgParts.get(SQLSTATE);
if (message != null) {
totalMessage.append("\n ").append(GT.tr("Server SQLState: {0}", message));
}
}
return totalMessage.toString();
}
```
Would it be possible to add the SQLState by default or make it available through some configuration other than the log level ?
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 #3558: Add SQLState to PSQLException default message
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