Bug #80215 | ORDER BY with GROUP BY no longer working on MySQL 5.7.10 | ||
---|---|---|---|
Submitted: | 1 Feb 2016 4:33 | Modified: | 1 Feb 2016 17:07 |
Reporter: | Thiago Thiago | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.7.10 | OS: | Ubuntu |
Assigned to: | CPU Architecture: | Any | |
Tags: | GROUP BY, order by |
[1 Feb 2016 4:33]
Thiago Thiago
[1 Feb 2016 4:53]
Thiago Thiago
Testing more I realize that the table tabtemp is giving the result on the same order both in MySQL 5.5 and 5.7 if I remove "GROUP BY". So the problem start happen when adding the GROUP BY. mysql> SELECT id FROM (SELECT id from login ORDER BY id DESC) tabtemp LIMIT 3; +------+ | id | +------+ | 2030 | | 2029 | | 2028 | +------+
[1 Feb 2016 5:25]
Thiago Thiago
Same as Bug #80131
[1 Feb 2016 5:45]
Thiago Thiago
Solved adding GROUP BY together with ORDER BY SELECT tabtemp.id FROM (SELECT id FROM (SELECT id from login GROUP BY id ORDER BY id DESC) tabtemp2) tabtemp GROUP BY 1=1; Hopping devoppers would review that part, seems more people are having the same issue, once they migrate to the new version the software will start giving wrong results. It will take long till realize that something is wrong once it will not give any error or warning.
[1 Feb 2016 5:47]
Thiago Thiago
Ops, ignore last comment. Thats is the right SELECT SELECT id FROM (SELECT id from login GROUP BY id ORDER BY id DESC) tabtemp GROUP BY 1=1;
[1 Feb 2016 17:07]
MySQL Verification Team
Thank you for the bug report. Please see: https://bugs.mysql.com/bug.php?id=80131