Implement ONLY_FULL_GROUP_BY compatibility (#15) (#16)

SQL92 requires that all columns (except aggregates) in the select clause
is part of the group by clause. SQL99 loosens this restriction a bit and
states that all columns in the select clause must be functionally
dependent of the group by clause.

This commit fixes all partial GROUP BY queries to be compatible with
SQL92. Previously, when MySQLs sql_mode included ONLY_FULL_GROUP_BY,
aggregating queries failed, resulting in an empty domain listing.
This commit is contained in:
Alexander Dormann 2016-05-14 12:03:06 +02:00 committed by Lukas Metzger
parent 0d1f5503ae
commit dc8fab4d42

View file

@ -35,7 +35,7 @@ if(isset($input->action) && $input->action == "getDomains") {
LEFT OUTER JOIN records R ON D.id = R.domain_id
LEFT OUTER JOIN permissions P ON D.id = P.domain
WHERE (P.user=? OR ?)
GROUP BY D.id
GROUP BY D.id, D.name, D.type
HAVING
(D.name LIKE ? OR ?) AND
(D.type=? OR ?)