Hi Jens, Thanks for your enquiry. Indeed, this syntax is so weird and rare, I'm not sure if it makes sense to support it in jOOQ. There's often a workaround with EXISTS that runs a semi-join instead of the JOIN. In my opinion, that's more formally correct, although it may be slower on MySQL...
Yes, your approach would be the ideal workaround for this case. Thanks for documenting it for future readers! Lukas 2016-06-22 16:35 GMT+02:00 <[email protected]>: > Although this is an old issue it seems that the DELETE-JOIN-Syntax is > still not implemented. For future readers (including me^^): is the > following helper-method a reasonable workaround until the feature is > implemented? > > public static Query deleteJoin(Collection<Table<?>> > tables,TableOnConditionStep<Record> joinStep, Condition where){ > return DSL.query("DELETE {0} FROM {1} WHERE > {2}",DSL.list(tables),joinStep,where); > } > > and then call it like > > Query query = > deleteJoin(Arrays.asList(Table.A,Table.B),Table.A.join(Table.B).on(Table.A.ID.eq( > Table.B.ID)),Table.A.ID.eq(someid)); > int numrows = dslContext.execute(query); > > ? > > > > > Am Sonntag, 8. Juni 2014 15:52:03 UTC+2 schrieb Lukas Eder: >> >> Hi Aurélien, >> >> >> 2014-06-07 14:58 GMT+02:00 Aurélien Manteaux <[email protected]>: >> >>> Hi Lukas, >>> >>> Thank you for this explanation, I didn't suspect this solution may >>> corrupt the database. >>> >> >>> However, as you pointed out in Stack Overflow, the MySQL limitation is >>> only here because the query optimizer is lazy :) >>> So it might be nice if jOOQ would do the query transformation. >>> >> >> Well, as this seems to be common practice, yes, we'll apply this >> transformation, eventually. >> >> >>> But so you know, for me this feature is not urgent at all. >>> >> >> Good, because it won't be that easy :-) >> Maybe, you could try to achieve it yourself, by writing a VisitListener? >> >> >>> Anyway, thank you for your time, it is nice to see that jOOQ is that >>> much active ;) >>> >> >> Yes, we're pushing! >> >> Cheers >> Lukas >> > -- > 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.
