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

A BOOLEAN != NOT NOT INT predicate evaluates false in projection but true in filtering

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      For the only row `(t2.c0, t2.c1) = (TRUE, 1500534146)`, `NOT (NOT t2.c1)` is `1`, so `t2.c0 != (NOT (NOT t2.c1))` is `1 != 1`, i.e. false. MariaDB's own projection evaluation reports that value as false, so the `WHERE` clause that builds `join_temp_2` should reject the row. Instead, MariaDB keeps the row and the subsequent join returns `1500534146 | 1500534146`.

      How to repeat:

      CREATE TABLE t1(c0 INT);
      CREATE TABLE t2(c0 BOOLEAN, c1 INT);

      INSERT INTO t1 VALUES (0);
      INSERT INTO t2 VALUES (TRUE, 1500534146);

      CREATE TEMPORARY TABLE join_temp_2 (c0 TINYINT(1) NOT NULL, c1 INT NOT NULL);
      INSERT INTO join_temp_2 SELECT * FROM t2 WHERE (t2.c0 != (NOT (NOT t2.c1)));

      SELECT t2.c1, t2.c1
      FROM t1 STRAIGHT_JOIN join_temp_2 AS t2
      ON (t1.c0 < t2.c1); – Expected correct result: <empty> – actual Wrong result: 1500534146 | 1500534146

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              yx yx
              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.