Postgres won't accept table alias before column name

╄→гoц情女王★ 提交于 2019-12-01 02:09:13

The problem is that you include the table alias in SET clause, in the columns. See the documentation of UPDATE in Postgres docs:

column

The name of a column in table. The column name can be qualified with a subfield name or array subscript, if needed. Do not include the table's name in the specification of a target column — for example, UPDATE tab SET tab.col = 1 is invalid.

This is valid in Postgres:

update GREETING Greeting 
set 
    NAME='World', 
    PHRASE='Hello World!' 
where Greeting.ID=5 ;

Check documentation on UPDATE statement, specifically for the column part: it is illegal to prefix columns with table alias in the SET clause.

UPDATE GREETING Greeting
   SET ID=5, NAME='World', PHRASE='Hello World!'
 WHERE (Greeting.ID=5);

Try using the latest Jodd, v3.3.7. where this issue is fixed.

The problem was in the Jodd library: entity update methods were generating update statement with table aliases. The new version simply does not put table aliases; that works for Postgres and for other databases too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!