[MDEV-6097] Inconsistent results for CAST(int,decimal,double AS DATETIME) Created: 2014-04-15  Updated: 2014-06-04  Resolved: 2014-06-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.3.12, 5.5.36, 10.0.10
Fix Version/s: 5.5.38, 10.0.12, 5.3.13

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: compat56

Issue Links:
Blocks
blocks MDEV-6001 Merge tests for MySQL WL#946 TIME/DAT... Stalled

 Description   

For the query:

SELECT CAST(010203101112 AS DATETIME(1)) AS c1,CAST(010203101112.3+0e0 AS DATETIME(1)) AS c2,CAST(010203101112.3+0e0 AS DATETIME(1)) AS c3;

MySQL5.6 consistently returns values with YEAR=2001:

+-----------------------+-----------------------+-----------------------+
| c1                    | c2                    | c3                    |
+-----------------------+-----------------------+-----------------------+
| 2001-02-03 10:11:12.0 | 2001-02-03 10:11:12.3 | 2001-02-03 10:11:12.3 |
+-----------------------+-----------------------+-----------------------+

MariaDB returns either 2001 or 0001 in year:

+-----------------------+-----------------------+-----------------------+
| c1                    | c2                    | c3                    |
+-----------------------+-----------------------+-----------------------+
| 2001-02-03 10:11:12.0 | 0001-02-03 10:11:12.2 | 0001-02-03 10:11:12.2 |
+-----------------------+-----------------------+-----------------------+

MySQL-5.6 results look better.



 Comments   
Comment by Alexander Barkov [ 2014-06-04 ]

Pushed into 5.3 and 5.5

Generated at Thu Feb 08 07:09:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.