Bug #33697 | "order by col DESC" in a query may give a result set in a wrong order | ||
---|---|---|---|
Submitted: | 4 Jan 2008 21:27 | Modified: | 1 Feb 2008 18:23 |
Reporter: | John Water | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | MySQL 6.0.3 Alpha | OS: | Any (Win-XP) |
Assigned to: | Igor Babaev | CPU Architecture: | Any |
Tags: | DESC, order by, query |
[4 Jan 2008 21:27]
John Water
[5 Jan 2008 15:07]
Valeriy Kravchuk
Thank you for a bug report. Verified just as described. It may be something similar to bug #31001, but in 6.0.x.
[10 Jan 2008 0:37]
Igor Babaev
The same problem can be observed for 5.1 (but not for 5.0): mysql> select version() // +-----------------+ | version() | +-----------------+ | 5.1.23-rc-debug | +-----------------+ 1 row in set (0.01 sec) mysql> select * from test3 where tid = 1 and vid = 3 order by idx desc -> // +-----+-----+-----+---------+------+ | vid | tid | idx | name | type | +-----+-----+-----+---------+------+ | 3 | 1 | 1 | pk | NULL | | 3 | 1 | 4 | c_extra | NULL | | 3 | 1 | 3 | c2 | NULL | | 3 | 1 | 2 | c1 | NULL | +-----+-----+-----+---------+------+ 4 rows in set (0.00 sec)
[10 Jan 2008 0:39]
Igor Babaev
The problem can be observed on any platform.
[11 Jan 2008 8:00]
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/40894 ChangeSet@1.2656, 2008-01-11 00:03:39-08:00, igor@olga.mysql.com +4 -0 Fixed bug #33697. When the function test_if_skip_sort_order prefers index backward scan to ref access the corresponding access functions must be set accordingly.
[11 Jan 2008 18:02]
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/40928 ChangeSet@1.2656, 2008-01-11 10:05:34-08:00, igor@olga.mysql.com +4 -0 Fixed bug #33697. When the function test_if_skip_sort_order prefers index backward scan to ref access the corresponding access functions must be set accordingly.
[24 Jan 2008 11:56]
Bugs System
Pushed into 6.0.5-alpha
[24 Jan 2008 12:01]
Bugs System
Pushed into 5.1.24-rc
[1 Feb 2008 18:23]
Paul DuBois
Noted in 5.1.24, 6.0.5 changelogs. ORDER BY ... DESC sorts could produce misordered results.
[4 Mar 2008 12:30]
Igor Babaev
Bug#34708 is marked as a duplicate of this bug.
[6 Mar 2008 15:49]
Jon Stephens
Also documented for 5.1.23-ndb-6.2.14.
[2 Apr 2008 16:51]
Jon Stephens
Also documented fix in the 5.1.23-ndb-6.3.11 changelog.