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

doesn't handle collate for min/max(enum/set column) #31638

Closed
wjhuang2016 opened this issue Jan 13, 2022 · 1 comment · Fixed by #31819
Closed

doesn't handle collate for min/max(enum/set column) #31638

wjhuang2016 opened this issue Jan 13, 2022 · 1 comment · Fixed by #31819
Assignees
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. severity/critical sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@wjhuang2016
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table tt(a char(10), b enum('a', 'B', 'c'), c set('a', 'B', 'c'), d json) collate utf8mb4_general_ci;
insert into tt values ("a", "a", "a", JSON_OBJECT("a", "a"));
insert into tt values ("A", "A", "A", JSON_OBJECT("A", "A"));
insert into tt values ("b", "b", "b", JSON_OBJECT("b", "b"));
insert into tt values ("B", "B", "B", JSON_OBJECT("B", "B"));
insert into tt values ("c", "c", "c", JSON_OBJECT("c", "c"));
insert into tt values ("C", "C", "C", JSON_OBJECT("C", "C"));
split table tt by (0), (1), (2), (3), (4), (5);
select min(b) from tt;
select max(b) from tt;
select min(c) from tt;
select max(c) from tt;

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

mysql> select min(b) from tt;
+--------+
| min(b) |
+--------+
| a      |
+--------+
1 row in set (0.00 sec)

mysql> select max(b) from tt;
+--------+
| max(b) |
+--------+
| c      |
+--------+
1 row in set (0.00 sec)

mysql> select min(c) from tt;
+--------+
| min(c) |
+--------+
| a      |
+--------+
1 row in set (0.00 sec)

mysql> select max(c) from tt;
+--------+
| max(c) |
+--------+
| c      |
+--------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> select min(b) from tt;
+--------+
| min(b) |
+--------+
| B      |
+--------+
1 row in set (0.02 sec)

mysql> select max(b) from tt;
+--------+
| max(b) |
+--------+
| c      |
+--------+
1 row in set (0.00 sec)

mysql> select min(c) from tt;
+--------+
| min(c) |
+--------+
| B      |
+--------+
1 row in set (0.00 sec)

mysql> select max(c) from tt;
+--------+
| max(c) |
+--------+
| c      |
+--------+
1 row in set (0.00 sec)

4. What is your TiDB version? (Required)

master

@wjhuang2016 wjhuang2016 added type/bug The issue is confirmed as a bug. affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. severity/critical sig/execution SIG execution labels Jan 13, 2022
@wjhuang2016 wjhuang2016 assigned wjhuang2016 and unassigned XuHuaiyu Jan 19, 2022
@github-actions
Copy link

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

@zanmato1984 zanmato1984 added sig/sql-infra SIG: SQL Infra and removed sig/execution SIG execution labels Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. severity/critical sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants