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

Unexpected result when using equal operator <=>

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.3.2, 11.4.1
    • None
    • None
    • None
    • Run on Docker container mariadb:latest and mariadb:11.4-rc

    Description

      Consider the below queries, it is unexpected that two queries both return 0.

      The Null-safe equal returns `1` if both operands are `NULL`. Thus the second query should return `1`, since `t0.c1` is `NULL`, and thus the expression `t0.c1<=>t0.c1 IS NULL` should be evaluated to `0`, and `NOT 0` is `1`.

      DROP DATABASE db0;
      CREATE DATABASE db0;
      USE db0;
       
      CREATE TABLE t0(c1 INT);
      INSERT INTO t0 (c1) VALUES (NULL);
       
      SELECT (t0.c1<=>t0.c1) IS NULL FROM t0; -- 0
      SELECT NOT ((t0.c1<=>t0.c1) IS NULL) FROM t0; -- 0 (unexpected)
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              suyzhong Suyang Zhong
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.