[MDEV-9336] ALTER from DOUBLE to TIME returns a wrong result Created: 2015-12-28  Updated: 2019-11-18

Status: Open
Project: MariaDB Server
Component/s: Data types, Temporal Types
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.4

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

Epic Link: Data type cleanups

 Description   

This script:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a TIME);
INSERT INTO t1 VALUES (0.999e19);
SELECT * FROM t1;

correctly returns:

+-----------+
| a         |
+-----------+
| 838:59:59 |
+-----------+

This script:

DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (a TIME);
CREATE TABLE t2 (a DOUBLE);
INSERT INTO t2 VALUES (0.999e19);
INSERT INTO t1 SELECT a FROM t2;
SELECT * FROM t1;

also correctly returns:

+-----------+
| a         |
+-----------+
| 838:59:59 |
+-----------+

This script:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (0.999e19);
ALTER TABLE t1 MODIFY a TIME;
SELECT * FROM t1;

erroneously returns

+----------+
| a        |
+----------+
| 00:00:00 |
+----------+

The expected result is 838:59:59, like in the previous two scripts.


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