[jOOQ/jOOQ#17397] IN-list padding truncates row IN lists to 1000

elements in Oracle pre 23ai
This commit is contained in:
Lukas Eder 2024-09-30 16:51:15 +02:00
parent fadd02fd81
commit 26f39d7248
2 changed files with 22 additions and 35 deletions

View File

@ -198,47 +198,34 @@ abstract class AbstractInList<T> extends AbstractCondition {
else
ctx.visit(trueCondition());
}
else if (values.size() > limit) {
// [#798] Oracle and some other dialects can only hold 1000 values
// in an IN (...) clause
switch (ctx.family()) {
case DERBY:
// [#798] Oracle and some other dialects can only hold 1000 values
// in an IN (...) clause
else if (REQUIRES_IN_LIMIT.contains(ctx.dialect()) && values.size() > limit) {
ctx.sqlIndentStart('(');
for (int i = 0; i < values.size(); i += limit) {
if (i > 0) {
case FIREBIRD: {
ctx.sqlIndentStart('(');
for (int i = 0; i < values.size(); i += limit) {
if (i > 0) {
// [#1515] The connector depends on the IN / NOT IN
// operator
if (in)
ctx.formatSeparator()
.visit(K_OR)
.sql(' ');
else
ctx.formatSeparator()
.visit(K_AND)
.sql(' ');
}
toSQLSubValues(ctx, field, in, padded(ctx, values.subList(i, Math.min(i + limit, values.size())), limit));
}
ctx.sqlIndentEnd(')');
break;
// [#1515] The connector depends on the IN / NOT IN
// operator
if (in)
ctx.formatSeparator()
.visit(K_OR)
.sql(' ');
else
ctx.formatSeparator()
.visit(K_AND)
.sql(' ');
}
// Most dialects can handle larger lists
default: {
toSQLSubValues(ctx, field, in, padded(ctx, values, limit));
break;
}
toSQLSubValues(ctx, field, in, padded(ctx, values.subList(i, Math.min(i + limit, values.size())), limit));
}
ctx.sqlIndentEnd(')');
}
// Most dialects can handle larger lists
else
toSQLSubValues(ctx, field, in, padded(ctx, values, limit));
}

View File

@ -139,7 +139,7 @@ implements
ctx.visit(left)
.sql(' ')
.visit((not ? NOT_IN : IN).toKeyword())
.sql(" (").visit(new QueryPartListView<>(AbstractInList.padded(ctx, right, AbstractInList.limit(ctx)))).sql(')');
.sql(" (").visit(new QueryPartListView<>(AbstractInList.padded(ctx, right, Integer.MAX_VALUE))).sql(')');
}
}
}