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

Incorrect query result: WHERE condition and WHERE NOT condition return the same row simultaneously (violates boolean logic)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Duplicate
    • 11.8.5
    • N/A
    • Optimizer
    • None
    • Not for Release Notes

    Description

      When executing a query with a complex logical expression composed of string/integer/bitwise/XOR operations in the WHERE clause,both the condition and its negation (NOT) return the same row.

      This is a critical logical error that breaks fundamental boolean logic.A row cannot simultaneously satisfy a condition AND its negation.

      Steps to Reproduce:
      DROP DATABASE IF EXISTS database28;
      CREATE DATABASE database28;
      USE database28;

      CREATE TABLE `t0` (
      `c0` double DEFAULT NULL,
      UNIQUE KEY `c0` (`c0`),
      KEY `ic2` (`c0` DESC)
      );

      INSERT INTO t0 VALUES (908772674);

      – Query 1
      SELECT t0.c0 FROM t0
      WHERE NOT ('.6OF}~L9' XOR ((-1747543273 IN (t0.c0, t0.c0)) ^ 1028288693));

      – Query 2 (logical negation of Query 1)
      SELECT t0.c0 FROM t0
      WHERE ('.6OF}~L9' XOR ((-1747543273 IN (t0.c0, t0.c0)) ^ 1028288693));

      Actual Result
      Both queries return the same row:
      -----------

      c0

      -----------

      908772674

      -----------
      1 row in set, 1 warning (0.00 sec)

      Attachments

        Issue Links

          Activity

            People

              shipjain Shipra Jain
              zxtang Jason Tang
              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.