List:General Discussion« Previous MessageNext Message »
From:hsv Date:October 5 2012 4:35am
Subject:date-IFNULL-sum bug?
View as plain text  
Can anyone explain this to me?
The first one seems quite wrong; the rest make perfect sense.

mysql> select ifnull(date('1900/5/3'), date('1900/01/01')) + 10000;
+------------------------------------------------------+
| ifnull(date('1900/5/3'), date('1900/01/01')) + 10000 |
+------------------------------------------------------+
|                                                11900 |
+------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select ifnull(date('1900/5/3'), date('1900/01/01'));
+----------------------------------------------+
| ifnull(date('1900/5/3'), date('1900/01/01')) |
+----------------------------------------------+
| 1900-05-03                                   |
+----------------------------------------------+
1 row in set (0.00 sec)

mysql> select date('1900/5/3') + 10000;
+--------------------------+
| date('1900/5/3') + 10000 |
+--------------------------+
|                 19010503 |
+--------------------------+
1 row in set (0.00 sec)

mysql> select date(date('1900/5/3') + 10000);
+--------------------------------+
| date(date('1900/5/3') + 10000) |
+--------------------------------+
| 1901-05-03                     |
+--------------------------------+
1 row in set (0.00 sec)

(5.5.8 under muSoft Windows)

Thread
date-IFNULL-sum bug?hsv5 Oct
  • RE: date-IFNULL-sum bug?Rick James8 Oct
    • RE: date-IFNULL-sum bug?hsv9 Oct