[jOOQ/jOOQ#17947] Nesting row 3 times in a SELECT .. ORDER BY .. LIMIT

query leads to wrong results with dialects that emulate LIMIT or LIMIT
.. WITH TIES with NestedCollectionEmulation.XML
This commit is contained in:
Lukas Eder 2025-02-05 12:41:56 +01:00
parent 7ae77990d9
commit ecd65dbe73
2 changed files with 5 additions and 1 deletions

View File

@ -2217,7 +2217,10 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
.visit(K_FROM).sqlIndentStart(" (")
.subquery(true);
toSQLReference0(ctx, new AliasOverride(originalFields, aliasedFields), null);
// [#13560] [#17947] Communicate the enforcement of MULTISET content to the CursorImpl.
if (ctx.executeContext() != null)
ctx.executeContext().data(DATA_MULTISET_CONTENT, true);
ctx.data(DATA_MULTISET_CONTENT, true, c -> toSQLReference0(c, new AliasOverride(originalFields, aliasedFields), null));
ctx.subquery(false)
.sqlIndentEnd(") ")

View File

@ -306,6 +306,7 @@ final class XMLHandler<R extends Record> extends DefaultHandler {
if ("record".equalsIgnoreCase(qName) && f.getDataType().isRecord()) {
peek.values.add(newRecord(true, s.recordType, s.row, ctx.configuration()).operate(s::into));
s = states.pop();
s.inRecord--;
break x;
}
else if ("result".equalsIgnoreCase(qName) && f.getDataType().isMultiset()) {