Comment 1 for bug 694450

Revision history for this message
Kristian Nielsen (knielsen) wrote :

Philip, just to clarify, are there really two bugs here?

First, from a quick test, it looks to me as if ONLY_FULL_GROUP_BY simply is not taken into account for ORDER BY. Even trivial examples show this. Maybe it makes sense to report this to MySQL.

Second, you say that the two queries return different result sets (one row vs. several). This seems to be a regression compared to MariaDB 5.1.51, where I get the same set of rows from both queries:

MariaDB [test]> SELECT alias2.f3 AS field1 , alias2.f1 AS field2 FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f1 = alias1.f2 AND alias2.f1 != alias1.f4 GROUP BY field1 , field2 ORDER BY alias1.f2 , field2;
+---------------------+--------+
| field1 | field2 |
+---------------------+--------+
| 2004-10-11 18:13:00 | 1 |
| 2009-02-19 02:05:00 | 5 |
+---------------------+--------+
2 rows in set (0.00 sec)

MariaDB [test]> SELECT alias2.f3 AS field1 , alias2.f1 AS field2 FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f1 = alias1.f2 AND alias2.f1 != alias1.f4 GROUP BY field1 , field2 ;
+---------------------+--------+
| field1 | field2 |
+---------------------+--------+
| 2004-10-11 18:13:00 | 1 |
| 2009-02-19 02:05:00 | 5 |
+---------------------+--------+
2 rows in set (0.00 sec)

(Since you say "this bug is present in all MariaDB and MySQL versions", I was not sure if you meant just the ignoring of ONLY_FULL_GROUP_BY in ORDER BY, or also the result difference).