A small bug/feature, which I created a new bug for at http://bugs.mysql.com/25706. Basically, the CURRENT_DATE() function seems to assign a time to dates, and that time is 00:00:00. In fact, all DATE formats are actually DATETIMEs with the date field of 00:00:00 and hidden.
This interferes with queries that use the date as an actual date and expect the date to include everything up until 23:59:59 of that day. The easiest way to reproduce this:
SELECT IF(NOW() BETWEEN '2007-01-17' AND
'2007-01-18','yes','no') AS test\G
test: no
1 row in set (0.00 sec)
In fact, the following query always returns “no”, unless it’s exactly midnight:
SELECT IF(NOW() BETWEEN CURRENT_DATE() - INTERVAL 1 DAY AND
CURRENT_DATE(),'yes','no') AS test\G
test: no
1 row in set (0.00 sec)
This does not make logical …
[Read more]