Message-ID: From: "vlsi (@vlsi)" To: "pgjdbc/pgjdbc" Date: Thu, 08 Mar 2018 13:13:10 +0000 Subject: [pgjdbc/pgjdbc] issue #1136: Show SQL text (and/or binds) in SQLException message List-Id: X-GitHub-Author-Id: 213894 X-GitHub-Author-Login: vlsi X-GitHub-Issue: 1136 X-GitHub-Labels: easy X-GitHub-Milestone: 42.3.0 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: open X-GitHub-Type: issue X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/1136 Content-Type: text/plain; charset=utf-8 Here's how an SQLException looks like: ``` setEncodingAscii[allowEncodingChanges=true](org.postgresql.test.jdbc2.ClientEncodingTest) Time elapsed: 0.026 sec <<< ERROR! org.postgresql.util.PSQLException: ERROR: syntax error at or near "x" Position: 14 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365) at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307) at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293) at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270) at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:224) at org.postgresql.test.jdbc2.ClientEncodingTest.checkConnectionSanity(ClientEncodingTest.java:73) at org.postgresql.test.jdbc2.ClientEncodingTest.setEncodingAscii(ClientEncodingTest.java:68) ``` I wish the message did include the SQL in question. It would be so much easier to debug in case the statement did include SQL text, etc. What do you think? Is there a security issue with that? Can the feature be enabled by default?