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

    XMLWordPrintable

    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

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: