[MDEV-15420] Wrong result for CAST from TIME or DATETIME with zero integer part and non-zero microseconds to DECIMAL(X,Y) Created: 2018-02-25  Updated: 2018-02-25  Resolved: 2018-02-25

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.2, 10.3
Fix Version/s: 10.2.14, 10.3.6

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


 Description   

SET sql_mode=''; -- Allow zero date
SELECT
  CAST(TIMESTAMP'0000-00-00 00:00:00.123456' AS DECIMAL(10,6)) AS c1,
  CAST(TIME'00:00:00.123456' AS DECIMAL(10,6)) AS c2;

+----------+----------+
| c1       | c2       |
+----------+----------+
| 0.000000 | 0.000000 |
+----------+----------+

The expected result would be 0.123456 for both columns.


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