Skip to content
Advertisement

inline with name in returning section ignores value in Jooq

Looks like there is no possibility to inline value with name in returning section in Jooq 3.10

I tried such queries

and

In the first case it is converted into such sql

And I receive an error that there is no role field

and in the second case it is converted into

And I can’t refer to the inlined column by name on fetching stage

Advertisement

Answer

Indeed, there was a known and very unfortunate limitation of that InsertReturningStep.returning() method, it is only allowed to project columns from the table that you insert into, no expressions.

This problem was solved in jOOQ 3.11 via the new InsertReturningStep.returningResult() method via issue #1234. The original method was not retrofitted due to backwards compatibility constraints. You can now do:

I don’t think there’s an easy way to work around this problem in jOOQ 3.11, short of converting the entire query to a plain SQL templating query

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement