Bug #87835 | the combination of SELECT DISTINCT and ORDER BY give wrong result for some data | ||
---|---|---|---|
Submitted: | 22 Sep 2017 8:19 | Modified: | 22 Sep 2017 10:27 |
Reporter: | Lin Lu | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S1 (Critical) |
Version: | 5.7.19 | OS: | Ubuntu (Ubuntu 16.04.2 LTS) |
Assigned to: | CPU Architecture: | Any | |
Tags: | distinct, order by |
[22 Sep 2017 8:19]
Lin Lu
[22 Sep 2017 8:20]
Lin Lu
test data for Bug #87835
Attachment: mysql57_bug.dump.bz2 (application/x-bzip2, text), 21.25 KiB.
[22 Sep 2017 8:23]
Lin Lu
also if you delete even just 1 row from either item or user table, everything would works fine. the problem just happend for the exact test data and sql
[22 Sep 2017 10:27]
MySQL Verification Team
Thank you for the bug report and test case. Only 5.7 server version affected by this bug.
[19 Dec 2018 1:33]
Jesper wisborg Krogh
Posted by developer: Reproduces in 5.7.24. For me using the included test case, I get the correct result when I change to use MyISAM for the on disk internal temporary tables: SET GLOBAL internal_tmp_disk_storage_engine = MyISAM; The test case does not reproduce in 8.0.13 (even with the 5.7 settings for internal_tmp_disk_storage_engine and internal_tmp_mem_storage_engine).
[19 Dec 2018 1:41]
Jesper wisborg Krogh
Posted by developer: Another workaround is to use GROUP BY instead of DISTINCT.