#2392 - Oracle specific singleAttribute distinct query - not include the column twice with order by clause

This commit is contained in:
Rob Bygrave
2021-09-23 18:48:40 +12:00
parent cebac8040f
commit 35a6ff7f02
@@ -583,7 +583,7 @@ final class CQueryBuilder {
final OrderBy<?> orderBy = query.getOrderBy();
if (orderBy != null && orderBy.supportsSelect()) {
String trimmed = DbOrderByTrim.trim(dbOrderBy);
if (query.isSingleAttribute() && trimmed.equals(select.getSelectSql())) {
if (query.isSingleAttribute() && select.getSelectSql().startsWith(trimmed)) {
// NOP, already in SQL
// TODO: what to do if we select("id").orderBy("prop,id")?
// Can we live with a query like "select t0.id, t0.prop, t0.id from"