Postgres JDBC driver: PSQLException: syntax error at or near RETURNING

前端 未结 3 2022
无人共我
无人共我 2021-02-13 14:56

For some reason the JDBC PostgreSQL driver is adding: RETURNING * to the end of select statements. Why?

Code:

protected         


        
3条回答
  •  情歌与酒
    2021-02-13 15:23

    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.

提交回复
热议问题