|
mysql> SELECT ADDDATE(TIMESTAMP'0000-00-00 00:20:12',0) as add1, ADDDATE(IFNULL(TIMESTAMP(NULL),TIME'00:20:12'),0) as indirect,IFNULL(TIMESTAMP(NULL),TIME'00:20:12') as add2;
|
+------+---------------------+---------------------+
|
| add1 | indirect | add2 |
|
+------+---------------------+---------------------+
|
| NULL | 0000-00-00 00:20:12 | 0000-00-00 00:20:12 |
|
+------+---------------------+---------------------+
|
1 row in set, 1 warning (0.00 sec)
|
|
ADDDATE(TIMESTAMP'0000-00-00 00:20:12',0) correctly returns NULL,
because it requires a value date.
However, ADDDATE() erroneously returns a non-NULL if the value
comes indirectly, e.g. from the IFNULL function.
The expected result of "add2" should also be NULL.
|