Details
-
Type:
Bug
-
Status: Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 10.0.8
-
Fix Version/s: 10.0
-
Component/s: None
-
Labels:None
Description
CAST(TIME'10:10:10' AS DATE) returns '2010-10-10' in MariaDB-5.5 and
in MySQL.
MariaDB-10.0 returns '0000-00-00'.
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Is that bad? I think the new result is ok. The date part of TIME'10:10:10' is DATE'0000-00-00'. You can see that explicitly when casting to datetime, it'll be DATETIME'0000-00-00 10:10:10'.
There's no logical explanation why the date part of TIME'10:10:10' shoud be '2010-10-10'. And I don't consider "because we internally cast time to a string and then to date" a particularly convincing explanation.
Compare, for example, with double→integer cast:
when casted to a string, it's "1e15". If you cast this string to an integer, you get "1". But double→integer cast is not using strings, that's you get the correct result — the integer part of the floating-point number.