[jOOQ/jOOQ#5799] Fix asterisk expansion for WITH ORDINALITY

If WITH ORDINALITY is emulated using a derived table, then we must not fully qualify the fields.

This probably produces other issues when it is safe to expect fully qualified columns from a WITH ORDINALITY table, including a performance penalty when looking up field references in records.
This commit is contained in:
Lukas Eder 2023-01-10 16:56:04 +01:00
parent 4e9589e71b
commit d93eba5a33

View File

@ -146,6 +146,12 @@ implements
@Override
final FieldsImpl<R> fields0() {
FieldsImpl<R> r = new FieldsImpl<>(delegate.fields0().fields);
// [#5799] If WITH ORDINALITY is emulated using a derived table, then
// we must not fully qualify the fields.
for (int i = 0; i < r.fields.length; i++)
r.fields[i] = DSL.field(delegate.getUnqualifiedName().append(r.fields[i].getUnqualifiedName()), r.fields[i].getDataType());
r.add(DSL.field(N_ORDINAL, BIGINT));
return r;
}