-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
incorrect tableDual plan which would cause no result #50051
Comments
Problem comes from When meeting a math.MaxInt64 for KindInt64 or 0 for KindUint64, simply an nil is returned. Another corner case (0 for KindUint64) shows below: CREATE TABLE `t5` (`d` int not null, `c` int not null, PRIMARY KEY (`d`, `c`));
CREATE TABLE `t6` (`d` bigint UNSIGNED not null);
insert into t5 values (-3, 6);
insert into t6 values (0), (1), (2), (3);
select * from t5 where d < (select min(d) from t6);
select * from t5 where d < (select min(d) from t6) and d < 3;
result follows (also can be reproduced on master branch): mysql> select version();
+--------------------+
| version() |
+--------------------+
| 8.0.11-TiDB-v7.5.1 |
+--------------------+
1 row in set (0.01 sec)
mysql> select * from t5 where d < (select min(d) from t6);
+----+---+
| d | c |
+----+---+
| -3 | 6 |
+----+---+
1 row in set (0.01 sec)
mysql> select * from t5 where d < (select min(d) from t6) and d < 3;
Empty set (0.01 sec)
mysql> explain select * from t5 where d < (select min(d) from t6) and d < 3;
+--------------+---------+------+---------------+---------------+
| id | estRows | task | access object | operator info |
+--------------+---------+------+---------------+---------------+
| TableDual_31 | 0.33 | root | | rows:0 |
+--------------+---------+------+---------------+---------------+
1 row in set (0.01 sec) The function should deal with the boundary value correctly. I guess it is not a bad idea to change the type of the point in this case. Patch comes later |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
TableRangeScan
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
33480e8
The text was updated successfully, but these errors were encountered: