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

Unexpected Results when Comparing Boolean with Floating-point

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 11.2.2
    • N/A
    • Optimizer
    • None
    • Latest docker image on Ubuntu 22.04

    Description

      Considering the test case below:

      The third `SELECT` returns an empty result, which is surprising: If the result of second query is -0.4 (`TRUE`), the value of the `true - c1/10` in `WHERE` condition should also be true, and thus the third query should return the row in `t0`.

      CREATE TABLE t0(c1 INT);
      INSERT INTO t0(c1) VALUES (14);
       
      SELECT * FROM t0; -- 14
      SELECT true-c1/10 FROM t0; -- -0.4000
      SELECT * FROM t0 WHERE true-c1/10; 
      -- Expected: 14
      -- Actual: empty
      

      I originally find this in the latest docker image.

      Attachments

        Activity

          People

            Unassigned Unassigned
            suyzhong Suyang Zhong
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.