-
Notifications
You must be signed in to change notification settings - Fork 4
Description
I am trying to use the driver together with PrestoDB. I encountered few issues, this is the last of them, with changes needed for it - the driver works!
The description of Transactions in Readme.md is misleading, it is actually the opposite, if you set conn.autoCommit(false) the queries will start failing - see details below.
If you use the driver as a part of bigger framework you might not be able to prevent the framework from switching the autoCommit to false.
Given that the whole driver is Read Only - the simplest option is to remove the ability to switch it in PgConnection. Then the the whole paragraph in Readme.md could be removed, will not make any sense.
Details
- Executing conn.setAutocommit(false) switches the driver into transactional mode
- the first query ("select col from table") will be automatically prefixed with BEGIN by QueryExecutor
- and will fail with
org.postgresql.util.PSQLException: ERROR: XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected "<id>", expecting "<end of file>"
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2476)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2189)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:301)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:287)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:264)
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:231)
wich is difficult to trace as the message from ML is not very helpful
Without conn.setAutoCommit(false) it all works perfectly.
Let me know if I should create pull request that will remove the functionality to switch PgConnection.setAutoCommit()