Skip to content
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

Different behave between MySQL and TiDB in query #21167

Open
blacktear23 opened this issue Nov 20, 2020 · 3 comments
Open

Different behave between MySQL and TiDB in query #21167

blacktear23 opened this issue Nov 20, 2020 · 3 comments

Comments

@blacktear23
Copy link
Contributor

Bug Report

1. Minimal reproduce step (Required)

create table t (id varchar(20) primary key);
insert into t values('asdf'), ('1asdf');

mysql> select * from t where id = timestamp'0000-00-00 00:00:00';
Empty set, 2 warnings (0.00 sec)

mysql> select * from t where id = date'0000-00-00';
ERROR 1292 (22007): Incorrect datetime value: '0000-00-00'

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

In MySQL:

mysql> select * from t where id = timestamp'0000-00-00 00:00:00';
+-------+
| id    |
+-------+
| 1asdf |
| asdf  |
+-------+
2 rows in set, 2 warnings (0.00 sec)

mysql> select * from t where id = date'0000-00-00';
+-------+
| id    |
+-------+
| 1asdf |
| asdf  |
+-------+
2 rows in set, 2 warnings (0.00 sec)

3. What did you see instead (Required)

See section 1.

4. What is your TiDB version? (Required)

Release Version: v4.0.0-beta.2-1588-ge33271784-dirty
Edition: Community
Git Commit Hash: e332717
Git Branch: issue-21123
UTC Build Time: 2020-11-19 03:08:05
GoVersion: go1.15.2
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

@blacktear23 blacktear23 added the type/bug The issue is confirmed as a bug. label Nov 20, 2020
@blacktear23
Copy link
Contributor Author

@bb7133 @wjhuang2016 PTAL

@blacktear23
Copy link
Contributor Author

blacktear23 commented Nov 20, 2020

I think this is related to ZERO value type convert and compare is not fully compatible with MySQL.

@wjhuang2016 wjhuang2016 added type/compatibility and removed type/bug The issue is confirmed as a bug. labels Nov 20, 2020
@ghost
Copy link

ghost commented Nov 20, 2020

Yeah, I think it might be related to #10485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants