-
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
Wrong join results when joining a datetime column with a string column in some cases #13018
Comments
Confirming that this can still be reproduced against master: drop table if exists t;
create table t (
a varchar(30),
b datetime
);
insert into t values ("2000-01-01", "2000-01-01");
insert into t values ("2000xxxxxx", "2000-01-02");
select t1.a, t2.b from t t1, t t2 where t1.a != t2.b;
..
mysql> select t1.a, t2.b from t t1, t t2 where t1.a != t2.b;
+------------+---------------------+
| a | b |
+------------+---------------------+
| 2000-01-01 | 2000-01-02 00:00:00 |
+------------+---------------------+
1 row in set, 2 warnings (0.00 sec)
mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-782-gb72e47e6d
Edition: Community
Git Commit Hash: b72e47e6db8863c08e47714391cf937b0f1c3269
Git Branch: master
UTC Build Time: 2020-07-15 01:26:06
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec) |
This issue has the same root cause with #17868. |
I find this issue is hard to fix. The root cause is that our comparison operator is not null-aware. But MySQL also contradicts itself:
Since it's hard to fix and it only happens when comparing Datetime with invalid Datetime string, I suggest degrading this issue's severity and don't fix it now. @lzmhhh123 @SunRunAway |
I agree with that. What's your opinion? @SunRunAway |
Is this bug fixed now? |
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
In MySQL:
In TiDB:
tidb-server -V
or runselect tidb_version();
on TiDB)?The text was updated successfully, but these errors were encountered: