[jOOQ/jOOQ#15629] InlineDerivedTable can't be outer joined

This commit is contained in:
Lukas Eder 2023-09-22 14:12:37 +02:00
parent ca8fa16e42
commit 67aa9616f4

View File

@ -207,7 +207,13 @@ implements
static final void accept2(Context<?> ctx, Table<?> table, Name unqualifiedName) {
ctx.data(DATA_OMIT_CLAUSE_EVENT_EMISSION, true, c -> {
if (c.qualify() && table != null && !FALSE.equals(ctx.data(DATA_RENDER_TABLE)))
c.visit(table).sql('.');
// [#15629] In some cases (e.g. outer joins), where an InlineDerivedTable can't be
// inlined and must generate a derived table, we mustn't fully qualify fields.
if (table instanceof TableImpl && ((TableImpl<?>) table).where != null)
c.qualify(false, c2 -> c2.visit(table).sql('.'));
else
c.visit(table).sql('.');
c.visit(unqualifiedName);
});