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

Double negation is treated as original value in WHERE clause

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.5.2, 10.6, 10.11, 11.4, 11.8, 10.5(EOL)
    • 10.6, 10.11, 11.4, 11.8
    • Optimizer
    • None
    • Ubuntu (x86)

    Description

      Consider the following test case:

      CREATE TABLE t0(c0 INT);
      INSERT INTO t0(c0) VALUES(123);
      SELECT t0.c0 AS ref0 FROM t0 WHERE 1 = (NOT(NOT(t0.c0)));
      

      The query does not fetch any rows.

      The expected result should be:

      ref0
      123

      The condition evaluates to true in the WHERE clause for the row in the table. This is verified as follows:

      SELECT t0.c0, 1 = (NOT(NOT(t0.c0))) FROM t0;
      

      t0.c0 1 = (NOT(NOT(t0.c0)))
      123 1

      It is likely that the expression NOT(NOT(t0.c0)) was incorrectly optimized as t0.c0.

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              emilyong Emily Ong
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.