[MDEV-4868] Length of CURRENT_TIME is too long. Created: 2013-08-09  Updated: 2022-09-08

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.3.12, 5.5.36, 10.0.10
Fix Version/s: 5.5

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


 Description   

CURRENT_TIME is limited to positive time in the range
from 00:00:00 to 23:59:59. So it should be enough 8 characters
to store it. However, it uses 10 characters in MariaDB-10.0.

For this script:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 AS SELECT CONCAT(CURRENT_TIME());
SHOW COLUMNS FROM t1;

MariaDB 5.1 and 5.3 correctly returned length 8
(but wrong data type varbinary).

+------------------------+--------------+------+-----+---------+-------+
| Field                  | Type         | Null | Key | Default | Extra |
+------------------------+--------------+------+-----+---------+-------+
| CONCAT(CURRENT_TIME()) | varbinary(8) | NO   |     |         |       |
+------------------------+--------------+------+-----+---------+-------+

MariaDB 5.5 and 10.0 return wrong length (but correct data type varchar):

+------------------------+-------------+------+-----+---------+-------+
| Field                  | Type        | Null | Key | Default | Extra |
+------------------------+-------------+------+-----+---------+-------+
| CONCAT(CURRENT_TIME()) | varchar(10) | NO   |     |         |       |
+------------------------+-------------+------+-----+---------+-------+

MySQL 5.5 and 5.6 return both type and length correctly:

MySQL-5.5 and MySQL-5.6
+------------------------+------------+------+-----+---------+-------+
| Field                  | Type       | Null | Key | Default | Extra |
+------------------------+------------+------+-----+---------+-------+
| CONCAT(CURRENT_TIME()) | varchar(8) | NO   |     |         |       |
+------------------------+------------+------+-----+---------+-------+



 Comments   
Comment by Elena Stepanova [ 2014-04-11 ]

Actually, 5.1 and 5.2 return varbinary(8); 5.3 returns varbinary(10); 5.5 and 10.0 returns varchar(10).

Generated at Thu Feb 08 06:59:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.