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

Incorrect result when comparing INT column with floating-point constant

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 11.8.6
    • N/A
    • Optimizer
    • None
    • Ubuntu 24.04 LTS x86_64 docker image mariadb:11.8.6
    • Not for Release Notes

    Description

      A query involving a comparison between an INT column and a floating-point constant may return rows that do not satisfy the WHERE predicate.

      In the following example, the predicate t0.c0 = 1.1 evaluates to FALSE for the row t0.c0 = 1, so the first query should return an empty set. However, it returns (1).

      The second query shows that the predicate t0.c0 = 1.1 evaluates to FALSE, indicating that the returned row does not satisfy the WHERE condition.

      CREATE TABLE t0(c0 INT);
      CREATE INDEX i0 ON t0(c0);
       
      INSERT INTO t0(c0) VALUES(1);
       
      SELECT t0.c0 AS ref1 FROM t0 WHERE t0.c0 = 1.1;
      /*Actual: (1); Expected: empty set*/
       
      SELECT (t0.c0) = 1.1 FROM t0;
      /* Returns 1 row: (0) */
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              asdWang Weipeng Wang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.