Bug #20805 | select with order by date_add crashes the server | ||
---|---|---|---|
Submitted: | 1 Jul 2006 16:25 | Modified: | 5 Jul 2006 13:55 |
Reporter: | Dag Nygren | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.0.22 | OS: | Linux (linux) |
Assigned to: | CPU Architecture: | Any |
[1 Jul 2006 16:25]
Dag Nygren
[1 Jul 2006 18:18]
Sveta Smirnova
Thank you for the report. Please, also provide us output of SHOW CREATE TABLE processitem \G statement for every table from your query.
[5 Jul 2006 12:57]
Dag Nygren
Added the requested data some days ago. Is that enough?
[5 Jul 2006 13:40]
Sveta Smirnova
Thank you for your bug report. I can repeat it as you said using mysql-standard-5.0.22, but can not using last developer source tree. If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html
[5 Jul 2006 13:55]
Dag Nygren
Ok, so it is fixed now. Very good. I don't need the repos access as I found a way to work around the problem in my reporting script. Thanks for reacting (and confirming) though.
[21 Aug 2007 4:04]
Mike Hoeffner
I've run into a similar problem with 5.0.22 (it's okay in 5.0.45) and it's not just due to a DATE_ADD in the ORDER BY. Here are additional details if it helps in anyway such as for test cases. It only happens when the following are true: 1) DATE_ADD is in the select 2) DATE_ADD is also in the group by and/or order by 3) The interval in the group by / order by DATE_ADD is calculated based on a selected column This happens against both InnoDB and MyISAM tables. It does not matter if there is data in the tables being queried. DATE_SUB not surprisingly causes the same problem. Below are examples to reproduce. They are nonsense queries but it was the easiest way to come up with the simplest test cases. Create table Foo ( timex DateTime, numx Smallint ) ENGINE = InnoDB; -- no crash SELECT DATE_ADD(timex, INTERVAL 1 DAY) FROM Foo GROUP BY DATE_ADD(timex, INTERVAL 1 DAY); -- no crash SELECT DATE_ADD(timex, INTERVAL 1 DAY) FROM Foo ORDER BY DATE_ADD(timex, INTERVAL 1 DAY); -- no crash SELECT timex FROM Foo GROUP BY DATE_ADD(timex, INTERVAL 1 DAY); -- crash SELECT DATE_ADD(timex, INTERVAL 1 DAY) FROM Foo GROUP BY DATE_ADD(timex, INTERVAL numx DAY); -- crash SELECT DATE_ADD(timex, INTERVAL 1 DAY) FROM Foo ORDER BY DATE_ADD(timex, INTERVAL numx DAY);