From 4fd408c5e2856bc9d688d41a27a1df5be0a67d34 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Sun, 30 Jun 2013 15:54:03 +0200 Subject: [PATCH] [#2464] Fixed this also for the instance table model --- .../src/main/java/org/jooq/impl/DeleteQueryImpl.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/impl/DeleteQueryImpl.java b/jOOQ/src/main/java/org/jooq/impl/DeleteQueryImpl.java index 9e7ea8d5d1..2c2635a691 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DeleteQueryImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/DeleteQueryImpl.java @@ -109,9 +109,15 @@ class DeleteQueryImpl extends AbstractQuery implements DeleteQ // [#2464] MySQL supports a peculiar multi-table DELETE syntax for aliased tables: // DELETE t1 FROM my_table AS t1 - if (getFrom() instanceof TableAlias && asList(MARIADB, MYSQL).contains(context.configuration().dialect())) { - context.sql(getFrom()) - .sql(" "); + if (asList(MARIADB, MYSQL).contains(context.configuration().dialect())) { + + // [#2579] TODO: Improve Table API to discover aliased tables more + // reliably instead of resorting to instanceof: + if (getFrom() instanceof TableAlias || + (getFrom() instanceof TableImpl && ((TableImpl)getFrom()).getAliasedTable() != null)) { + context.sql(getFrom()) + .sql(" "); + } } context.keyword("from ");