Bug #30666 | Incorrect order when using range conditions on 2 tables or more | ||
---|---|---|---|
Submitted: | 28 Aug 2007 9:14 | Modified: | 19 Nov 2007 5:02 |
Reporter: | Daniel DeLorme | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.0.22 - 5.0.45, 5.0 BK | OS: | Linux (Ubuntu 6.06) |
Assigned to: | Alexey Kopytov | CPU Architecture: | Any |
[28 Aug 2007 9:14]
Daniel DeLorme
[28 Aug 2007 9:18]
Valeriy Kravchuk
Thank you for a problem report. I do not see any data attached, though.
[28 Aug 2007 9:20]
Daniel DeLorme
Source data used to reproduce the bug
Attachment: bug-30666-source-data.sql (text/x-sql), 138.90 KiB.
[28 Aug 2007 19:35]
Sveta Smirnova
Thank you for the report. Verified as described using last development sources. Only version 5.0 is affected.
[29 Oct 2007 12:50]
Timour Katchaounov
Wrong order => wrong data, so P2.
[7 Nov 2007 11:01]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/37246 ChangeSet@1.2548, 2007-11-07 14:00:45+03:00, kaa@polly.(none) +3 -0 Fix for bug #30666: Incorrect order when using range conditions on 2 tables or more The problem was that the optimizer used the join buffer in cases when the result set is ordered by filesort. This resulted in the ORDER BY clause being ignored, and the records being returned in the order determined by the order of matching records in the last table in join. Fixed by relaxing the condition in make_join_readinfo() to take filesort-ordered result sets into account, not only index-ordered ones.
[16 Nov 2007 9:31]
Bugs System
Pushed into 5.0.52
[16 Nov 2007 9:33]
Bugs System
Pushed into 5.1.23-rc
[16 Nov 2007 9:36]
Bugs System
Pushed into 6.0.4-alpha
[19 Nov 2007 5:02]
Paul DuBois
Noted in 5.0.52, 5.1.23, 6.0.4 changelogs. The optimizer could ignore ORDER BY in cases when the result set is ordered by filesort, resulting in rows being returned in incorrect order.
[6 Mar 2008 6:45]
Sveta Smirnova
Bug #35061 was marked as duplicate of this one.