You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
CREATETABLEt0(c0 BOOL);
INSERT INTO t0 (c0) VALUES (NULL);
CREATETABLEt1(c0 BOOL, c1 BOOL);
INSERT INTO t1 (c0, c1) VALUES (NULL, true);
SELECTt0.c0AS ref0,
t1.c0AS ref1
FROM t0
INNER JOIN t1 ONt1.c1=1WHEREt0.c0<=>t1.c0;
2. What did you expect to see? (Required)
ref0
ref1
null
null
This is also the expected result in MySQL (8.0) and MariaDB (11.5).
3. What did you see instead (Required)
no rows
This result is unexpected because the INNER JOIN in the original query (without including the WHERE clause) produces the following rows:
ref0
ref1
null
null
Since the null-safe equals operator evaluates to 1 for NULL <=> NULL, this row should be returned in the result.
Moreover, by considering the query plan for this query, it appears that the standard equals operator is used in the evaluation of the where clause instead of the null-safe equals operator.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
This is also the expected result in MySQL (8.0) and MariaDB (11.5).
3. What did you see instead (Required)
no rows
This result is unexpected because the INNER JOIN in the original query (without including the WHERE clause) produces the following rows:
Since the null-safe equals operator evaluates to 1 for
NULL <=> NULL
, this row should be returned in the result.Moreover, by considering the query plan for this query, it appears that the standard equals operator is used in the evaluation of the where clause instead of the null-safe equals operator.
Furthermore, consider the following query, where the WHERE condition uses
(t0.c0 <=> t1.c0) IS TRUE
instead oft0.c0 <=> t1.c0
.The query plan of the above query is as follows, where the null-safe equals operator is correctly used:
This query produces the expected result:
Both queries are semantically equivalent, but produce different results, which is unexpected.
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: