Message-ID: From: "rmagnin-efluid (@rmagnin-efluid)" To: "pgjdbc/pgjdbc" Date: Wed, 05 Mar 2025 13:28:25 +0000 Subject: [pgjdbc/pgjdbc] issue #3558: Add SQLState to PSQLException default message List-Id: X-GitHub-Author-Id: 57394438 X-GitHub-Author-Login: rmagnin-efluid X-GitHub-Issue: 3558 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: open X-GitHub-Type: issue X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3558 Content-Type: text/plain; charset=utf-8 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 ?