List:Bugs« Previous MessageNext Message »
From:sasha Date:August 7 2000 7:37pm
Subject:Re: date_add behaviour changed between 3.23.21 and .22
View as plain text  
Balint TOTH wrote:
> 
> Hi All!
> 
> I installed 3.23.22 from source on the weekend without any problems..
> 
> But later (today) i relalized that some of the queries return different
> result since the upgrade.
> 
> The problem itself:
> on 3.23.21:
> select date_add(curdate(),INTERVAL 1 DAY) -> "2000-08-08"
> on 3.23.22:
> select date_add(curdate(),INTERVAL 1 DAY) -> "2000-08-08 00:00:00"
> 
> it changes the return value to datetime, which is bad in a query where
> the original field is a date and your where condition looks like
> date_add(<date column>, INTERVAL <integer column> days)<curdate()

This is not a bug,  the old behaviour was not correct. It does expose another
bug, though. datetime is the correct return type of date_add/date_sub because it
is possible to add INTERVAL 1 HOUR. The bug that it exposes is the incorrect
equality comparison of date and datetime, which we will fix in the next release

-- 
Sasha Pachev

+------------------------------------------------------------------+
|      ____  __     _____   _____  ___     http://www.mysql.com    |
|     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|     Sasha Pachev            |
|    /*/ /*/ /*/   \*\_   |*|   |*||*|     sasha@stripped         |
|   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|     Provo, Utah, USA        |
|  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|____                         |
|  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^                        |
|             /*/             \*\ Developers Team                  |
+------------------------------------------------------------------+
Thread
date_add behaviour changed between 3.23.21 and .22Balint TOTH7 Aug
  • Re: date_add behaviour changed between 3.23.21 and .22sasha7 Aug
    • RE: date_add behaviour changed between 3.23.21 and .22Balint TOTH8 Aug
  • date_add behaviour changed between 3.23.21 and .22Michael Widenius10 Aug