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

`NOT IN` over a RIGHT JOIN-produced NULL row returns TRUE for one probe value

    XMLWordPrintable

Details

    Description

      the inner `RIGHT JOIN` can only yield one `NULL` `t3.c0`, so both probes `1` and `2` should evaluate `t2.c0 NOT IN (subquery)` to `NULL`. MariaDB instead turns the second probe into `TRUE`.

      CREATE TABLE t0(c0 INT PRIMARY KEY);
      CREATE TABLE t2(c0 REAL PRIMARY KEY);
      CREATE TABLE t3(c0 BOOLEAN PRIMARY KEY);

      INSERT INTO t0 VALUES (1);
      INSERT INTO t2 VALUES (1), (2);
      INSERT INTO t3 VALUES (FALSE);

      SELECT t2.c0 NOT IN (
      SELECT t3.c0
      FROM t3 RIGHT JOIN t0
      ON ((t3.c0 IS NULL) AND (t3.c0 != t3.c0))
      GROUP BY t3.c0
      HAVING COUNT > 0
      )
      FROM t2
      ORDER BY t2.c0; – Expected correct result: NULL ; NULL – actual Wrong result: NULL ; 1

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            yx yx
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.