[#4292] Wrong emulation of "grand total" GROUP BY () clause in dialects that do not natively support them

This commit is contained in:
lukaseder 2015-05-20 15:49:25 +02:00
parent 474c29262b
commit 61579c63f2

View File

@ -81,6 +81,7 @@ import static org.jooq.SQLDialect.SQLITE;
// ...
// ...
// ...
// ...
import static org.jooq.SortOrder.ASC;
import static org.jooq.impl.CombineOperator.EXCEPT;
import static org.jooq.impl.CombineOperator.INTERSECT;
@ -1090,7 +1091,9 @@ class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> implement
// Some dialects don't support empty GROUP BY () clauses
else if (asList(CUBRID, DERBY, FIREBIRD, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE).contains(dialect)) {
context.sql('1');
context.sql('(')
.visit(DSL.select(one()))
.sql(')');
}
// Few dialects support the SQL standard "grand total" (i.e. empty grouping set)