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

This commit is contained in:
Lukas Eder 2024-06-03 13:45:59 +02:00
parent b7fef0f418
commit 62efa74ebb

View File

@ -777,8 +777,7 @@ implements
acceptFrom(ctx, where0, f);
boolean limitEmulation = limitEmulation(ctx);
if (limitEmulation) {
if (limitEmulation(ctx)) {
// [#16632] Push down USING table list here
TableList t1 = new TableList();
@ -794,7 +793,8 @@ implements
where0.addConditions(row(keyFields).in(select(keyFields).from(t1).where(getWhere()).orderBy(orderBy).limit(limit)));
}
if (hasWhere() && !limitEmulation)
// [#16733] Repeat the WHERE clause in case we have a non-empty FROM clause
if (hasWhere() && (from.isEmpty() || supportFromOrUpdateJoin(ctx)))
where0.addConditions(getWhere());
else if (!where0.hasWhere() && REQUIRES_WHERE.contains(ctx.dialect()))
where0.addConditions(trueCondition());