-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.may-affects-5.4This bug maybe affects 5.4.x versions.This bug maybe affects 5.4.x versions.may-affects-6.1may-affects-6.5may-affects-7.1may-affects-7.5severity/majorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
CREATE TABLE t0(c0 FLOAT);
CREATE VIEW v0(c0) AS SELECT t0.c0 FROM t0;
INSERT INTO t0(c0) VALUES (NULL);
SELECT t0.c0 FROM v0 LEFT JOIN t0 ON 1 WHERE (TIMEDIFF( '2003-07-13', '2007-06-25') AND true);
SELECT c0 FROM (SELECT t0.c0, (TIMEDIFF('2003-07-13', '2007-06-25') AND true) IS TRUE AS flag FROM v0 LEFT JOIN t0 ON 1) AS t WHERE flag=1;
2. What did you expect to see? (Required)
The following two sqls should return the same result
SELECT t0.c0 FROM v0 LEFT JOIN t0 ON 1 WHERE (TIMEDIFF( '2003-07-13', '2007-06-25') AND true);
SELECT c0 FROM (SELECT t0.c0, (TIMEDIFF('2003-07-13', '2007-06-25') AND true) IS TRUE AS flag FROM v0 LEFT JOIN t0 ON 1) AS t WHERE flag=1;
3. What did you see instead (Required)
These two sqls return different results. If change LEFT JOIN to RIGHT JOIN, you also get the same result as the one below.
mysql> SELECT t0.c0 FROM v0 LEFT JOIN t0 ON 1 WHERE (TIMEDIFF( '2003-07-13', '2007-06-25') AND true);
+------+
| c0 |
+------+
| NULL |
+------+
1 row in set, 2 warnings (0.01 sec)
mysql> SELECT c0 FROM (SELECT t0.c0, (TIMEDIFF('2003-07-13', '2007-06-25') AND true) IS TRUE AS flag FROM v0 LEFT JOIN t0 ON 1) AS t WHERE flag=1;
+------------+
| c0 |
+------------+
| 1.4013e-45 |
+------------+
1 row in set, 4 warnings (0.01 sec)
4. What is your TiDB version? (Required)
TiDB-v7.6.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.may-affects-5.4This bug maybe affects 5.4.x versions.This bug maybe affects 5.4.x versions.may-affects-6.1may-affects-6.5may-affects-7.1may-affects-7.5severity/majorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.