Bug #48268 Wrong comparison of DATETIME values with microseconds
Submitted: 23 Oct 2009 15:14 Modified: 28 Apr 2010 8:00
Reporter: Evgeny Potemkin Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:5.0+ OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[23 Oct 2009 15:14] Evgeny Potemkin
Description:
Microseconds aren't taken into account when DATETIME fields are compared to DATETIME strings.

How to repeat:
select t = '2009-10-09 00:00:00.001', t <'2009-10-09 00:00:00.001' from (select  cast('2009-10-09 00:00:00' as datetime) t)tt;+-------------------------------+------------------------------+
| t = '2009-10-09 00:00:00.001' | t <'2009-10-09 00:00:00.001' |
+-------------------------------+------------------------------+
|                             1 |                            0 | 
+-------------------------------+------------------------------+

Suggested fix:
Take microseconds into account.
[24 Oct 2009 1:05] MySQL Verification Team
Thank you for the bug report.
[28 Apr 2010 8:00] Evgeny Potemkin
Duplicate of the bug#50774.