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

CEILING() and FLOOR() convert temporal input to numbers, unlike ROUND() and TRUNCATE()

Details

    Description

      Under terms of MDEV-20397 we modified functions ROUND() and TRUNCATE() to handle the TIME, DATETIME, TIMESTAMP data types correctly:

      SELECT ROUND(time'00:00:01.9'), TRUNCATE(TIMESTAMP'2001-01-01 00:00:01.9',0);
      

      +-------------------------+----------------------------------------------+
      | ROUND(time'00:00:01.9') | TRUNCATE(TIMESTAMP'2001-01-01 00:00:01.9',0) |
      +-------------------------+----------------------------------------------+
      | 00:00:02                | 2001-01-01 00:00:01                          |
      +-------------------------+----------------------------------------------+
      

      But the functions CEILING() and FLOOR() still convert temporal data types to numbers:

      SELECT CEILING(time'00:00:01.9'), FLOOR(TIMESTAMP'2001-01-01 00:00:01.9');
      

      +---------------------------+-----------------------------------------+
      | CEILING(time'00:00:01.9') | FLOOR(TIMESTAMP'2001-01-01 00:00:01.9') |
      +---------------------------+-----------------------------------------+
      |                         2 |                          20010101000001 |
      +---------------------------+-----------------------------------------+
      

      CEILING() and FLOOR() should be fixed to return TIME (for TIME input) and DATETIME (for DATETIME and TIMESTAMP input), like ROUND() and TRUNCATE() do.

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov created issue -
            bar Alexander Barkov made changes -
            Field Original Value New Value
            bar Alexander Barkov made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            bar Alexander Barkov made changes -
            Fix Version/s 10.4.14 [ 24305 ]
            Fix Version/s 10.5.5 [ 24423 ]
            Fix Version/s 10.4 [ 22408 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            bar Alexander Barkov made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 111749 ] MariaDB v4 [ 158154 ]

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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