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

Make "constant_string_expr+interval" look inside the constant to detect a correct data type

Details

    Description

      Notice the difference between the two expressions:

      mysql> select '10:10:10'+interval 1 minute, time('10:10:10')+interval 1 minute;
      +------------------------------+------------------------------------+
      | '10:10:10'+interval 1 minute | time('10:10:10')+interval 1 minute |
      +------------------------------+------------------------------------+
      | 2010-10-10 00:01:00          | 10:11:10                           |
      +------------------------------+------------------------------------+
      1 row in set (0.00 sec)

      The first expression should return '10:11:10',
      similar to the second one.

      Let's do it only in 10.x.

      Note, another temporal hybrid function ADDTIME() seems to work correctly:

      mysql> select addtime('10:10:10',1), addtime('2001-01-01 10:10:10',1);
      +-----------------------+----------------------------------+
      | addtime('10:10:10',1) | addtime('2001-01-01 10:10:10',1) |
      +-----------------------+----------------------------------+
      | 10:10:11              | 2001-01-01 10:10:11              |
      +-----------------------+----------------------------------+
      1 row in set (0.00 sec)

      Attachments

        Activity

          bar Alexander Barkov created issue -
          bar Alexander Barkov made changes -
          Field Original Value New Value
          Summary Make "constant_string_expr+interval" functions look inside the constant to detect a correct data type Make "constant_string_expr+interval" look inside the constant to detect a correct data type
          bar Alexander Barkov made changes -
          Description Notice the difference between the two expressions:

          {code}
          mysql> select '10:10:10'+interval 1 minute, time('10:10:10')+interval 1 minute;+------------------------------+------------------------------------+
          | '10:10:10'+interval 1 minute | time('10:10:10')+interval 1 minute |
          +------------------------------+------------------------------------+
          | 2010-10-10 00:01:00 | 10:11:10 |
          +------------------------------+------------------------------------+
          1 row in set (0.00 sec)
          {code}

          The first expression should return '10:11:10',
          similar to the second one.

          Let's do it only in 10.x.
          Notice the difference between the two expressions:

          {code}
          mysql> select '10:10:10'+interval 1 minute, time('10:10:10')+interval 1 minute;
          +------------------------------+------------------------------------+
          | '10:10:10'+interval 1 minute | time('10:10:10')+interval 1 minute |
          +------------------------------+------------------------------------+
          | 2010-10-10 00:01:00 | 10:11:10 |
          +------------------------------+------------------------------------+
          1 row in set (0.00 sec)
          {code}

          The first expression should return '10:11:10',
          similar to the second one.

          Let's do it only in 10.x.
          bar Alexander Barkov made changes -
          Description Notice the difference between the two expressions:

          {code}
          mysql> select '10:10:10'+interval 1 minute, time('10:10:10')+interval 1 minute;
          +------------------------------+------------------------------------+
          | '10:10:10'+interval 1 minute | time('10:10:10')+interval 1 minute |
          +------------------------------+------------------------------------+
          | 2010-10-10 00:01:00 | 10:11:10 |
          +------------------------------+------------------------------------+
          1 row in set (0.00 sec)
          {code}

          The first expression should return '10:11:10',
          similar to the second one.

          Let's do it only in 10.x.
          Notice the difference between the two expressions:

          {code}
          mysql> select '10:10:10'+interval 1 minute, time('10:10:10')+interval 1 minute;
          +------------------------------+------------------------------------+
          | '10:10:10'+interval 1 minute | time('10:10:10')+interval 1 minute |
          +------------------------------+------------------------------------+
          | 2010-10-10 00:01:00 | 10:11:10 |
          +------------------------------+------------------------------------+
          1 row in set (0.00 sec)
          {code}

          The first expression should return '10:11:10',
          similar to the second one.

          Let's do it only in 10.x.

          Note, another temporal hybrid function ADDTIME() seems to work correctly:
          {code}
          mysql> select addtime('10:10:10',1), addtime('2001-01-01 10:10:10',1);
          +-----------------------+----------------------------------+
          | addtime('10:10:10',1) | addtime('2001-01-01 10:10:10',1) |
          +-----------------------+----------------------------------+
          | 10:10:11 | 2001-01-01 10:10:11 |
          +-----------------------+----------------------------------+
          1 row in set (0.00 sec)
          {code}
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.8 [ 14200 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.9 [ 14400 ]
          Fix Version/s 10.0.8 [ 14200 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.10 [ 14500 ]
          Fix Version/s 10.0.9 [ 14400 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.11 [ 15200 ]
          Fix Version/s 10.0.10 [ 14500 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.12 [ 15201 ]
          Fix Version/s 10.0.11 [ 15200 ]
          serg Sergei Golubchik made changes -
          Workflow defaullt [ 30635 ] MariaDB v2 [ 44674 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.13 [ 16000 ]
          Fix Version/s 10.0.12 [ 15201 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 44674 ] MariaDB v3 [ 63696 ]
          bar Alexander Barkov made changes -
          bar Alexander Barkov made changes -
          Labels datatype
          bar Alexander Barkov made changes -
          Component/s Data types [ 13906 ]
          bar Alexander Barkov made changes -
          Component/s Temporal Types [ 11000 ]
          julien.fritsch Julien Fritsch made changes -
          Epic Link MDEV-21071 [ 80504 ]
          julien.fritsch Julien Fritsch made changes -
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 63696 ] MariaDB v4 [ 139565 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0 [ 16000 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.7 [ 24805 ]
          Fix Version/s 10.8 [ 26121 ]
          Fix Version/s 10.9 [ 26905 ]
          Fix Version/s 10.10 [ 27530 ]
          julien.fritsch Julien Fritsch made changes -
          Fix Version/s 10.7 [ 24805 ]
          julien.fritsch Julien Fritsch made changes -
          Fix Version/s 10.8 [ 26121 ]
          julien.fritsch Julien Fritsch made changes -
          Fix Version/s 10.11 [ 27614 ]
          julien.fritsch Julien Fritsch made changes -
          Fix Version/s 10.9 [ 26905 ]
          Fix Version/s 10.10 [ 27530 ]

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.