提交 faab0abd authored 作者: Thomas Mueller's avatar Thomas Mueller

When using order by in a query that uses the same table multiple times, the…

When using order by in a query that uses the same table multiple times, the order could be incorrect.
上级 21563c94
......@@ -372,11 +372,11 @@ public class Select extends Query {
if (!(expr instanceof ExpressionColumn)) {
return null;
}
Column col = ((ExpressionColumn) expr).getColumn();
if (col.getTable() != topTableFilter.getTable()) {
ExpressionColumn exprCol = (ExpressionColumn) expr;
if (exprCol.getTableFilter() != topTableFilter) {
return null;
}
sortColumns.add(col);
sortColumns.add(exprCol.getColumn());
}
Column[] sortCols = new Column[sortColumns.size()];
sortColumns.toArray(sortCols);
......@@ -887,6 +887,9 @@ public class Select extends Query {
if (isDistinctQuery) {
buff.append("\n/* distinct */");
}
if (sortUsingIndex) {
buff.append("\n/* index sorted */");
}
if (isGroupQuery) {
if (isGroupSortedQuery) {
buff.append("\n/* group sorted */");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论