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

Wrong Result: Inconsistent behavior between Index Lookup and Table Scan

    XMLWordPrintable

Details

    Description

      I have identified a result inconsistency bug where the query returns different results depending on whether the index is used or ignored.

      how to repeat:

      CREATE TABLE t1(
        c1 BIT, 
        c2 BIT NOT NULL, 
        UNIQUE (c2, c1)
      );
       
      INSERT INTO t1(c1,c2) VALUES (b'0',b'1'), (b'1',b'1');
      INSERT INTO t1(c2) VALUES (b'0');
       
       
      SELECT c2 FROM t1 
      WHERE (INET_NTOA('2016-12-24 09:00:00') NOT IN (SELECT c2 FROM t1));
      +--------+
      | c2     |
      +--------+
      | 0x00   |
      | 0x01   |
      | 0x01   |
      +--------+
      3 rows in set, 6 warnings
       
      SELECT c2 FROM t1 IGNORE INDEX (c2) 
      WHERE (INET_NTOA('2016-12-24 09:00:00') NOT IN (SELECT c2 FROM t1 IGNORE INDEX (c2)));
      Empty set, 6 warnings
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            March SerenMarch
            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.