Bug #103677 Max/Min for enum get different result whether using index
Submitted: 13 May 2021 8:04 Modified: 13 May 2021 8:22
Reporter: Shenghui Wu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:5.7.32, 8.0.22, 8.0.25, 5.7.34 OS:Any
Assigned to: CPU Architecture:Any

[13 May 2021 8:04] Shenghui Wu
Description:
Max/Min for enum get different result whether using index

How to repeat:
drop table t;
create table t(a enum('y','b','1','x','0','null') DEFAULT NULL,key(a));
insert into t values('y'),('b');
select min(a) from t;
MySQL [test]> select min(a) from t;
+--------+
| min(a) |
+--------+
| y      |
+--------+
1 row in set (0.000 sec)

drop table t;
create table t(a enum('y','b','1','x','0','null') DEFAULT NULL);
insert into t values('y'),('b');
select min(a) from t;
MySQL [test]> select min(a) from t;
+--------+
| min(a) |
+--------+
| b      |
+--------+
1 row in set (0.000 sec)
[13 May 2021 8:22] MySQL Verification Team
Hello Shenghui Wu,

Thank you for the report and test case.

regards,
Umesh