The type of year compare with 1- or 2-digit strings is not as expected #23262
Closed
Description
Bug Report
According to the mysql manual
As 1- or 2-digit strings in the range '0' to '99'. MySQL converts values in the ranges '0' to '69' and '70' to '99' to YEAR values in the ranges 2000 to 2069 and 1970 to 1999.
The TiDB didn't cover the converts of year type.
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
create table t(a year);
insert into t values(2002);
select * from t where a=2; -- 2002
select * from t where a='2'; -- empty
2. What did you expect to see? (Required)
2002
3. What did you see instead (Required)
empty set
4. What is your TiDB version? (Required)
Release Version: v4.0.0-beta.2-2338-g07b19e0f9
Edition: Community
Git Commit Hash: 07b19e0
Git Branch: master
UTC Build Time: 2021-03-11 09:14:11
GoVersion: go1.15.1
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false