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

Incorrect result when comparing a numeric string literal to a BIT column with a UNIQUE key

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6, 10.11, 11.4, 11.8, 12.1, 12.0.2
    • 10.11, 11.4, 11.8, 12.1
    • Optimizer
    • None

    Description

      When a BIT column has a UNIQUE key, a predicate comparing that column to a string literal behaves incorrectly, leading to rows being improperly filtered from the result set. The bug is triggered by the presence of the UNIQUE key.
      The inconsistency is evident when comparing the output of a WHERE clause filter against a direct evaluation of the same boolean expression in a SELECT list. The latter correctly computes the result for all rows, while the former does not.

      CREATE TABLE t0 ( c2 BIT(7), UNIQUE (c2)) ;
      INSERT  INTO t0 (c2) VALUES (b'1100011');
      INSERT INTO t0 (c2) VALUES (b'0010110');
       
      SELECT c2 AS ca1 FROM t0 WHERE (NOT (('9') >= (c2)));
      -- return 1100011
      SELECT SUM(count) FROM (SELECT ((NOT (('9') >= (c2)))) IS TRUE AS count FROM t0) AS ta_norec;
      -- return 2
      

      Attachments

        Issue Links

          Activity

            People

              Gosselin Dave Gosselin
              zhouhongtao zzz
              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.