Details
Description
There is a difference between explicit and implicit
DATETIME->TIME conversion when using a datetime
with zero year and month and non-zero day:
mysql> DROP TABLE IF EXISTS t1; Query OK, 0 rows affected (0.08 sec) mysql> CREATE TABLE t1 (a TIME); Query OK, 0 rows affected (0.18 sec) mysql> INSERT INTO t1 VALUES (TIMESTAMP'0000-00-01 10:20:30'); Query OK, 1 row affected (0.01 sec) mysql> SELECT * FROM t1; +----------+ | a | +----------+ | 34:20:30 | +----------+ 1 row in set (0.00 sec) mysql> SELECT CAST(TIMESTAMP'0000-00-01 10:20:30' AS TIME); +----------------------------------------------+ | CAST(TIMESTAMP'0000-00-01 10:20:30' AS TIME) | +----------------------------------------------+ | 10:20:30 | +----------------------------------------------+ 1 row in set (0.01 sec)
Notice, implicit conversion adds days to hours, while
explicit does not.
Implicit conversion should not add days to hours.
The problem also presents in the upstream.
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
what versions are affected?