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

Index causes incorrect result when comparing float-point number with INT

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Confirmed (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.5, 10.1, 10.2, 10.3, 10.4.11, 10.4, 10.0
    • Fix Version/s: 5.5, 10.1, 10.2, 10.3, 10.4, 10.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu 19.04

      Description

      Hi everyone,

      On the latest trunk version (0308de9), I could observe a bug, as demonstrated by the following test case:

      CREATE TABLE t0(c0 INT);
      INSERT INTO t0 VALUES (1);
      CREATE INDEX i0 ON t0(c0);
      SELECT * FROM t0 WHERE 0.5 = c0; -- unexpected: row is fetched
      

      Only when the index is created does MariaDB compute an incorrect result set, containing the row. As demonstrated below, the expression should evaluate to FALSE:

      SELECT 0.5 = c0 FROM t0; -- evaluates to FALSE
      

        Attachments

          Activity

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            mrigger Manuel Rigger
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: