提交 0ac40da2 authored 作者: Thomas Mueller's avatar Thomas Mueller

The query plan of queries with subqueries that contain nested joins was wrong.…

The query plan of queries with subqueries that contain nested joins was wrong. This could result in syntax exceptions for correct queries.
上级 e520041c
......@@ -994,7 +994,7 @@ public class Select extends Query {
} else {
buff.resetCount();
int i = 0;
for (TableFilter f : filters) {
for (TableFilter f : topFilters) {
buff.appendExceptFirst("\n");
buff.append(f.getPlanSQL(i++ > 0));
}
......
......@@ -633,10 +633,11 @@ public class TableFilter implements ColumnResolver {
buffNested.append("\n");
n = n.getJoin();
} while (n != null);
buff.append("(\n");
buff.append(StringUtils.indent(buffNested.toString(), 4, false));
buff.append(") ON ");
buff.append(")");
if (isJoin) {
buff.append(" ON ");
if (joinCondition == null) {
// need to have a ON expression,
// otherwise the nesting is unclear
......@@ -644,6 +645,7 @@ public class TableFilter implements ColumnResolver {
} else {
buff.append(StringUtils.unEnclose(joinCondition.getSQL()));
}
}
return buff.toString();
}
buff.append(table.getSQL());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论