Hi Lukas, Good to know that a fix in the pipeline - I guess for now I should just write this query in plain SQL?
Ben On Wed, May 20, 2015 at 3:17 PM, Lukas Eder <[email protected]> wrote: > Hi Ben, > > Yes, that's too bad. The INSERT .. SELECT API has a couple of flaws. This > particular flaw, I've just fixed recently for jOOQ 3.7: > https://github.com/jOOQ/jOOQ/issues/3779 > > Unfortunately, it won't be available for earlier versions... > > Cheers, > Lukas > > 2015-05-20 16:13 GMT+02:00 Ben Hood <[email protected]>: >> >> Hi Lukas, >> >> I can't seem to find the API to do an INSERT RETURNING using a SELECT, >> for example: >> >> db.execute(ctx -> >> ctx.insertInto(PRIMARY_ASSIGNMENTS, PRIMARY_ASSIGNMENTS.REGISTRANT, >> PRIMARY_ASSIGNMENTS.NUMBER). >> select( >> ctx.select(DSL.val(registrant), ALLOCATIONS.NUMBER.min()). >> from(ALLOCATIONS). >> where(ALLOCATIONS.NUMBER.notIn( >> ctx.select(ASSIGNMENTS.NUMBER). >> from(ASSIGNMENTS) >> ).and(ALLOCATIONS.REGISTRANT.eq(registrant))) >> ). >> execute() >> ); >> >> I was poking for some kind of returning() thingy, as you can use on a >> InsertValuesStepN. >> >> Or is it more idiomatic to do a plain jane >> >> ctx.insertInto(). >> values( >> ctx.select().stuff().here()). >> returning( >> field().from().stuff() >> ) >> >> ? >> >> Cheers, >> >> Ben >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jOOQ User Group" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
