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

Applying NOT twice on an integer in WHERE condition leads to incorrect results.

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 11.2.2
    • None
    • Optimizer
    • None
    • Ubuntu 20.04

    Description

      When applying NOT twice to an integer in WHERE condition, the result is incorrect.
      How to repeat:

      CREATE TABLE t(a INT);
      INSERT INTO t VALUES (-1);
      SELECT * FROM t WHERE (NOT (NOT (a))) = -1; -- [-1]
      SELECT (NOT (NOT (a))) FROM t; -- [1]
      

      The same expression yields inconsistent results when appearing in the WHERE condition and projection list. I believe that the result of applying NOT twice to an integer should be 1 or 0 rather than the original value.

      Attachments

        Activity

          People

            Unassigned Unassigned
            zhuangliu Zhuang Liu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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