Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
5.5.36, 10.0.9
Description
This query
SELECT CAST(DATE_ADD(101, INTERVAL 1 hour_second) AS SIGNED) AS c1, CAST(DATE_ADD(101, INTERVAL 1 hour_second) AS DOUBLE) AS c2, CAST(DATE_ADD(101, INTERVAL 1 hour_second) AS DECIMAL(20)) AS c3;
|
returns:
+------+----------------+----------------+
|
| c1 | c2 | c3 |
|
+------+----------------+----------------+
|
| 2000 | 20000101000001 | 20000101000001 |
|
+------+----------------+----------------+
|
|
The result must be the same for all three expressions.
The question is: which is correct?
The return value for "DATE_ADD(101, INTERVAL 1 hour_second)"
is '2000-01-01 00:00:01'. But the data type in this context is VARCHAR
(note VARCHAR is correct, as the argument is not a temporal data type!).
So it should probably return 2000 in all three cases, i.e. parse
the returned value as a string, without trying to treat it as a datetime.