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

Both (WHERE 0.1) and (WHERE NOT 0.1) return empty set

    XMLWordPrintable

Details

    Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (10);
      SELECT CASE WHEN 0.1 THEN 'TRUE' ELSE 'FALSE' END FROM t1;
      

      +--------------------------------------------+
      | CASE WHEN 0.1 THEN 'TRUE' ELSE 'FALSE' END |
      +--------------------------------------------+
      | TRUE                                       |
      +--------------------------------------------+
      

      The above script demonstrates:

      • 0.1 is evaluated to TRUE when in CASE
      • there is one record in the table t1

      Now I run these two queries:

      SELECT * FROM t1 WHERE 0.1;
      

      Empty set (0.00 sec)
      

      SELECT * FROM t1 WHERE NOT 0.1;
      

      Empty set (0.00 sec)
      

      Notice, both return empty set. Looks wrong. The query with WHERE 0.1 should return one record.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              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.