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

Unexpected result for query with RIGHT JOIN and IS TRUE in where clause

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3, 11.3.2, 11.4.1
    • 10.4, 10.5, 10.6, 10.11, 11.1, 11.2, 11.4
    • None
    • None
    • Run on Docker container mariadb:latest and mariadb:11.4-rc

    Description

      Consider the below queries, it is unexpected that the third query return an empty set.

      The `RIGHT JOIN` query returns `NULL 0`. The predicate `NOT (t1.c0 IS TRUE)` should be evaluated to `1`, since `t1.c0` is `NULL`, `t1.c0 IS TRUE` is `0`, and thus the whole expression should be evaluated to `1`, which also shown in the second query. The third query should then return `NULL 0` since the where predicate is `1`.

      MySQL could return the expected result.

      DROP DATABASE db0;
      CREATE DATABASE db0;
      USE db0;
       
      CREATE TABLE t0(c0 INT);
      CREATE TABLE t1(c0 INT);
      INSERT INTO t0 (c0) VALUES (0);
       
      SELECT * FROM t1 RIGHT  JOIN t0 ON true; -- NULL 0
      SELECT (NOT ((t1.c0) IS TRUE)) FROM t1 RIGHT  JOIN t0 ON true; -- 1
       
      SELECT * FROM t1 RIGHT  JOIN t0 ON true WHERE (NOT ((t1.c0) IS TRUE));
      -- Expected: NULL 0
      -- Actual: Empty set
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            suyzhong Suyang Zhong
            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.