Bug #48639 | NULL data in Timestamp column causes incorrect results | ||
---|---|---|---|
Submitted: | 9 Nov 2009 14:46 | Modified: | 12 Nov 2009 7:49 |
Reporter: | Yagnesh Chawda | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server: General | Severity: | S1 (Critical) |
Version: | 5.0.45 | OS: | Linux (RHEL 5-64 Bit) |
Assigned to: | CPU Architecture: | Any | |
Tags: | Empty Result Set, INDEX, null, timestamp |
[9 Nov 2009 14:46]
Yagnesh Chawda
[9 Nov 2009 15:31]
Yagnesh Chawda
Forgot to add create script for table, here it is: CREATE TABLE `test_bug` ( `ID` varchar(36) character set ascii NOT NULL default '', `NAME` varchar(64) default NULL, `JOINED_DATE` timestamp NULL default NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
[9 Nov 2009 15:39]
Valeriy Kravchuk
Thank you for the problem report. Please, try to repeat with a newer version, 5.0.86 at least, and inform about the results. Look: 77-52-7-73:5.0 openxs$ bin/mysql -uroot test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.0.88-debug Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> CREATE TABLE `test_bug` ( -> `ID` varchar(36) character set ascii NOT NULL default '', -> `NAME` varchar(64) default NULL, -> `JOINED_DATE` timestamp NULL default NULL, -> PRIMARY KEY (`ID`) -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Query OK, 0 rows affected (0.04 sec) mysql> insert into `test_bug`(`ID`,`NAME`,`JOINED_DATE`) values -> ('1','Yagnesh','2009-11-02 13:49:00'), -> ('2','Ankur','2009-11-09 13:49:00'), -> ('3','Sonal',NULL), -> ('4','Roshan',NULL), -> ('5','Ambi','2009-11-02 13:49:00'), -> ('6','Jigar',NULL); Query OK, 6 rows affected (0.00 sec) Records: 6 Duplicates: 0 Warnings: 0 mysql> select id , name, date_format(joined_date, '%d-%b-%y') from test_bug where -> date(joined_date) between '2009-10-01' and '2009-11-09' order by joined_date asc; +----+---------+--------------------------------------+ | id | name | date_format(joined_date, '%d-%b-%y') | +----+---------+--------------------------------------+ | 1 | Yagnesh | 02-Nov-09 | | 5 | Ambi | 02-Nov-09 | | 2 | Ankur | 09-Nov-09 | +----+---------+--------------------------------------+ 3 rows in set (0.00 sec) mysql> select id , name, date_format(joined_date, '%d-%b-%y') from test_bug where -> date(joined_date) between '2009-10-01' and '2009-11-09' order by joined_date desc; +----+---------+--------------------------------------+ | id | name | date_format(joined_date, '%d-%b-%y') | +----+---------+--------------------------------------+ | 2 | Ankur | 09-Nov-09 | | 1 | Yagnesh | 02-Nov-09 | | 5 | Ambi | 02-Nov-09 | +----+---------+--------------------------------------+ 3 rows in set (0.00 sec) So, I suspect that this problem is already fixed.
[11 Nov 2009 20:38]
Yagnesh Chawda
Hi, Thanks for the quick response. Its working fine with 5.0.84 as well ;) Did not get chance to test on 5.0.86 or later as per ur suggestion.
[12 Nov 2009 7:49]
Valeriy Kravchuk
Not repeatable with current versions.