sqlpostgresqljodd

Postgres won't accept table alias before column name


I'm using a framework (Jodd) which is adding the table alias to the column names in a SQL Select. It looks like well-formed SQL, but Postgres chokes on it.

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

gives an error:

Error: ERROR: column "greeting" of relation "greeting" does not exist
SQLState:  42703

Is there a way to get Postgres to accept that SQL? My other alternative is to hack the framework, which I don't want to do.


Solution

  • 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.