[jOOQ/jOOQ#12599] Incorrect MERGE statement syntax generated in FIREBIRD when aliasing USING derived table

This commit is contained in:
Lukas Eder 2021-11-03 17:29:02 +01:00
parent fcc4467913
commit 167ba3c705
2 changed files with 10 additions and 4 deletions

View File

@ -87,6 +87,7 @@ import static org.jooq.impl.Tools.map;
import static org.jooq.impl.Tools.visitSubquery;
import static org.jooq.impl.Tools.BooleanDataKey.DATA_AS_REQUIRED;
import static org.jooq.impl.Tools.BooleanDataKey.DATA_UNALIAS_ALIASED_EXPRESSIONS;
import static org.jooq.impl.Tools.BooleanDataKey.DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES;
import static org.jooq.impl.Tools.DataKey.DATA_SELECT_ALIASES;
import static org.jooq.impl.Values.NO_SUPPORT_VALUES;
@ -359,6 +360,13 @@ final class Alias<Q extends QueryPart> extends AbstractQueryPart implements UEmp
private final void toSQLWrapped(Context<?> ctx) {
boolean wrap = wrapInParentheses.test(ctx);
if (wrap)
ctx.data(DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES, false, c -> toSQLWrapped(c, wrap));
else
toSQLWrapped(ctx, wrap);
}
private final void toSQLWrapped(Context<?> ctx, boolean wrap) {
ctx.sql(wrap ? "(" : "")
.visit(wrapped)
.sql(wrap ? ")" : "");

View File

@ -1260,9 +1260,8 @@ implements
}
// This should probably execute an INSERT statement
else {
else
throw new IllegalStateException("Cannot omit KEY() clause on a non-Updatable Table");
}
}
else {
for (int i = 0; i < getUpsertKeys().size(); i++) {
@ -1351,9 +1350,8 @@ implements
break;
}
}
else {
else
toSQLStandard(ctx);
}
}
private final void toSQLMySQLOnDuplicateKeyUpdate(Context<?> ctx) {