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

IN with a mixture of TIME and DATETIME returns a wrong result

    XMLWordPrintable

    Details

      Description

      This query correctly returns TRUE:

      SELECT TIME'10:20:30' IN (102030,TIME'10:20:31');
      

      +-------------------------------------------+
      | TIME'10:20:30' IN (102030,TIME'10:20:31') |
      +-------------------------------------------+
      |                                         1 |
      +-------------------------------------------+
      

      If I add more values into the IN list, it returns FALSE with a warning:

      SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32');
      SHOW WARNINGS;
      

      +--------------------------------------------------------------------------+
      | TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') |
      +--------------------------------------------------------------------------+
      |                                                                        0 |
      +--------------------------------------------------------------------------+
      +---------+------+------------------------------------+
      | Level   | Code | Message                            |
      +---------+------+------------------------------------+
      | Warning | 1292 | Incorrect datetime value: '102030' |
      +---------+------+------------------------------------+
      

      CASE demonstrates the same problem. See MDEV-11555.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: