Skip to content

wrong null rejective with nulleq and is not null #58793

Closed

Description

@curry-oss

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

DROP TABLE IF EXISTS t0;
DROP TABLE IF EXISTS t1;
CREATE TABLE t0(c0 TEXT(227));
CREATE TABLE t1 LIKE t0;
INSERT INTO t1 VALUES ('');
SELECT COUNT(*) FROM t1 LEFT JOIN t0 ON t0.c0 <> t1.c0 WHERE (NULL AND t1.c0) <=> (t0.c0 IS NOT NULL);

2. What did you expect to see? (Required)

see the following case:

3. What did you see instead (Required)

// MySQL 8.4.1
MySQL [test]> SELECT COUNT(*) FROM t1 LEFT JOIN t0 ON t0.c0 <> t1.c0 WHERE (NULL AND t1.c0) <=> (t0.c0 IS NOT NULL);
+----------+
| COUNT(*) |
+----------+
|        1 |
+----------+
1 row in set (0.01 sec)

// TiDB
mysql> SELECT COUNT(*) FROM t1 LEFT JOIN t0 ON t0.c0 <> t1.c0 WHERE (NULL AND t1.c0) <=> (t0.c0 IS NOT NULL);
+----------+
| COUNT(*) |
+----------+
|        0 |
+----------+
1 row in set (0.04 sec)

4. What is your TiDB version? (Required)

TiDB v8.5.0

Activity

  1. curry-oss commented on Jan 8, 2025

    @curry-oss
    Author

    /label affects-8.5

  2. winoros commented on Jan 22, 2025

    @winoros
    Member

    The wrongly null rejective checking causes it.
    The outer join transformed to the inner join wrongly.

  3. changed the title [-]Bug Case in Left Join[/-] [+]wrong null rejective with nulleq and is not null[/+] on Jan 22, 2025
  4. self-assigned this
    on Sep 26, 2025
  5. added a commit that references this issue on Jun 1, 2026
    e4dc485
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.impact/wrong-resultseverity/moderatesig/plannerSIG: Plannertype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions