[jOOQ/jOOQ#16733] DML ORDER BY .. LIMIT emulation shouldn't repeat WHERE predicate

This commit is contained in:
Lukas Eder 2024-05-30 10:40:28 +02:00
parent 6603a30b0a
commit 09e75a5e23

View File

@ -787,7 +787,8 @@ implements
acceptFrom(ctx, where0, f);
if (limitEmulation(ctx)) {
boolean limitEmulation = limitEmulation(ctx);
if (limitEmulation) {
// [#16632] Push down USING table list here
TableList t1 = new TableList();
@ -803,7 +804,7 @@ implements
where0.addConditions(row(keyFields).in(select(keyFields).from(t1).where(getWhere()).orderBy(orderBy).limit(limit)));
}
if (hasWhere() && (from.isEmpty() || supportFromOrUpdateJoin(ctx)))
if (hasWhere() && !limitEmulation)
where0.addConditions(getWhere());
else if (!where0.hasWhere() && REQUIRES_WHERE.contains(ctx.dialect()))
where0.addConditions(trueCondition());