Bug #81767 Comparison result for column w/ YEAR(4) and const w/ 2 digits is incorrect
Submitted: 8 Jun 2016 4:44 Modified: 8 Jun 2016 7:37
Reporter: Su Dylan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.7.8, 5.6.30,5.6.31, 5.7.12, 5.7.13 OS:Any
Assigned to: CPU Architecture:Any

[8 Jun 2016 4:44] Su Dylan
Description:
Output:
===

mysql> drop table t1; create table t1(a year(4));
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

mysql> insert into t1 values (1930);
Query OK, 1 row affected (0.00 sec)

mysql> select a, a < 10 from t1;
+------+--------+
| a    | a < 10 |
+------+--------+
| 1930 |      1 |
+------+--------+
1 row in set (0.00 sec)

mysql> select version();
+--------------+
| version()    |
+--------------+
| 5.7.8-rc-log |
+--------------+
1 row in set (0.00 sec)

Problem:
===
"a < 10" is not reasonable.
It is expected to compare like ' a < 1910 '.

How to repeat:

drop table t1; create table t1(a year(4));
insert into t1 values (1930);
select a, a < 10 from t1;

Suggested fix:
"a < 10" returns 0.
[8 Jun 2016 7:37] MySQL Verification Team
Hello Su Dylan,

Thank you for the report and test case.

Thanks,
Umesh