Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25542

The last character is truncated when TIME_FORMAT function in the subquery

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.5.9, 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
    • None
    • None

    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

      Attachments

        Issue Links

          Activity

            alice Alice Sherepa added a comment -

            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)
            
            

            alice Alice Sherepa added a comment - 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)
            bar Alexander Barkov added a comment - - edited

            Also repeatable with simplified queries:

            MariaDB [test]> select time_format(time'-00:01:01', '%im %ss') as d;
            +----------+
            | d        |
            +----------+
            | -01m 01s |
            +----------+
            

            MariaDB [test]> select * from (select time_format(time'-00:01:01', '%im %ss') as d) t;
            +---------+
            | d       |
            +---------+
            | -01m 01 |
            +---------+
            

            bar Alexander Barkov added a comment - - edited Also repeatable with simplified queries: MariaDB [test]> select time_format( time '-00:01:01' , '%im %ss' ) as d; + ----------+ | d | + ----------+ | -01m 01s | + ----------+ MariaDB [test]> select * from ( select time_format( time '-00:01:01' , '%im %ss' ) as d) t; + ---------+ | d | + ---------+ | -01m 01 | + ---------+

            People

              Unassigned Unassigned
              rodion Rodion
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.