Bug #31709 Query result is wrong where using date() on a null value
Submitted: 19 Oct 2007 5:14 Modified: 19 Oct 2007 7:01
Reporter: Jedy Wu Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.45 OS:Linux (CentOS4.4, RHEL 4 )
Assigned to: CPU Architecture:Any

[19 Oct 2007 5:14] Jedy Wu
Description:
The query is terminated when date() function meet a null value.

How to repeat:
CREATE TABLE `test_table` (
  `d` datetime default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

insert into test_table values ("2007-10-19 00:00:00");
insert into test_table values (null);
insert into test_table values ("2007-10-20 00:00:00");

select * from test_table where date(d) > "2007-10-18";
+---------------------+
| d                   |
+---------------------+
| 2007-10-19 00:00:00 |
+---------------------+
1 row in set (0.00 sec)
[19 Oct 2007 7:01] Sveta Smirnova
Thank you for the report.

Bug is not repeatable with current development sources, although I can repeat it with version 5.0.45.

Please wait next release.
[30 Oct 2007 8:04] Sveta Smirnova
Bug #31933 was marked as duplicate of this one
[7 Nov 2007 10:03] Valeriy Kravchuk
Bug #32152 was marked as a duplicate of this one.
[19 Nov 2007 18:34] Valeriy Kravchuk
Bug #32494 was marked as a duplicate of this one.