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

BIGINT 99991231000000 to TIME'00:00:00' comparison is not consistent

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.0.14
    • Fix Version/s: 10.0
    • Component/s: None
    • Labels:
      None

      Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a BIGINT, b TIME);
      INSERT INTO t1 VALUES (99991231000000,'00:00:00');
      SELECT a, b, 99991231000000=TIME'00:00:00',a=TIME'00:00:00',99991231000000=b,a=b FROM t1;
      

      returns the following:

      +----------------+----------+-------------------------------+------------------+------------------+------+
      | a              | b        | 99991231000000=TIME'00:00:00' | a=TIME'00:00:00' | 99991231000000=b | a=b  |
      +----------------+----------+-------------------------------+------------------+------------------+------+
      | 99991231000000 | 00:00:00 |                             1 |                0 |                1 |    0 |
      +----------------+----------+-------------------------------+------------------+------------------+------+
      

      That is 999991231000000=TIME'00:00:00' is:

      • equal when both are literals
      • not equal with a numeric field and a TIME literal
      • equal with a numeric literal and a TIME field
      • not equal when both are fields

      This looks inconsistent, because in all cases it should be compared as TIME,
      according to the current comparison rules.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              bar Alexander Barkov added a comment -

              This should be easier to fix after pushing the refactoring done under terms of MDEV-6991.

              Show
              bar Alexander Barkov added a comment - This should be easier to fix after pushing the refactoring done under terms of MDEV-6991 .

                People

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

                  Dates

                  • Created:
                    Updated: