[MDEV-25542] The last character is truncated when TIME_FORMAT function in the subquery Created: 2021-04-27  Updated: 2021-04-27

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5, 10.0, 10.1, 10.5.9, 10.2, 10.3, 10.4, 10.5
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Rodion Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: upstream


 Description   

Query

select time_format(timediff('15:00:08', '15:01:08'), '%im %ss') as d

Returns -01m 00s as expected.
But inside the subquery, the last character is truncated.

select * from (
    select time_format(timediff('15:00:08', '15:01:08'), '%im %ss') as d
) t

Returns -01m 00



 Comments   
Comment by Alice Sherepa [ 2021-04-27 ]

Thanks! Repeatable on 5.5-10.5:

 
MariaDB [test]> select * from ( select time_format('00:05:30', '%S ABC'))  d ;
+-----------------------------------+
| time_format('00:05:30', '%S ABC') |
+-----------------------------------+
| 30 ABC                            |
+-----------------------------------+
1 row in set (0.001 sec)
 
MariaDB [test]> select * from ( select time_format('-00:05:30', '%S ABC'))  d ;
+------------------------------------+
| time_format('-00:05:30', '%S ABC') |
+------------------------------------+
| -30 AB                             |
+------------------------------------+
1 row in set (0.001 sec)

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