|
SELECT
|
LAST_DAY(TIME'00:00:00') AS c1,
|
CAST(CAST(LAST_DAY(TIME'00:00:00') AS DATE) AS TIME) AS c2,
|
CAST(LAST_DAY(TIME'00:00:00') AS TIME) AS c3;
|
+------------+----------+------+
|
| c1 | c2 | c3 |
|
+------------+----------+------+
|
| 2018-02-28 | 00:00:00 | NULL |
|
+------------+----------+------+
|
Notice, LAST_DAY(TIME'00:00:00') correctly returns the last day of the current month.
If I now cast this expression as DATE, and then cast as TIME again (like in c2), it correctly returns 00:00:00.
But if I cast this expression directly to TIME (like in c3), it erroneously returns NULL.
It should return 00:00:00 in the column c3.
|