For some reason the JDBC PostgreSQL driver is adding: RETURNING * to the end of select statements. Why?
Code:
protected
This looks like a problem with sql2o. The comments on the bug report say:
Whe using PostgreSQL, all SELECT statements will fail with message: org.postgresql.util.PSQLException: ERROR: syntax error at or near "RETURNING"
Seems to be related to this issue
This has been fixed with version 1.1.2.
The fix requires the QuirkMode enum flag to be set to PostgreSQL when creating a new instance of sql2o. It changes default behaviour of queries to NOT fetch generated keys by default. When it is needed to fetch generated keys, the returnGeneratedKeys parameter in the generateQuery method should be set.
Since Sql2o 1.6.0, include the sql2o-postgres dependency and use new PostgresQuirks()
instead of QuirksMode
.