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

order by + limit + utf8_unicode_ci,return error record #29711

Closed
vivid392845427 opened this issue Nov 12, 2021 · 1 comment · Fixed by #29778
Closed

order by + limit + utf8_unicode_ci,return error record #29711

vivid392845427 opened this issue Nov 12, 2021 · 1 comment · Fixed by #29778
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. severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@vivid392845427
Copy link

vivid392845427 commented Nov 12, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

new_collations_enabled_on_first_bootstrap = true
CREATE TABLE `tbl_39` (
  `col_250` text COLLATE utf8_unicode_ci NOT NULL,
  `col_251` enum('Alice','Bob','Charlie','David') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Charlie',
  PRIMARY KEY (`col_251`,`col_250`(1)) NONCLUSTERED
);

insert into tbl_39 values("gugNSTjqWSrACj","Bob");    
insert into tbl_39 values("HaaRdwkoeFCH"  ,"Charlie");
insert into tbl_39 values("HbLx"          ,"David"); 
insert into tbl_39 values("kL"            ,"Bob");    
insert into tbl_39 values("mvbA"          ,"Bob");    
insert into tbl_39 values("ogdMlMqsYQ"    ,"Charlie");
insert into tbl_39 values("oUHNKUlSt"     ,"Bob");    
insert into tbl_39 values("PiPcLwhtwIAEa" ,"David");  
insert into tbl_39 values("smCLRW"        ,"David");  
insert into tbl_39 values("WIVqt"         ,"Charlie");
insert into tbl_39 values("xtGixNnzTa"    ,"Bob"); 

select col_250,col_251 from tbl_39 where tbl_39.col_251 between 'Bob' and 'David' order by tbl_39.col_250,tbl_39.col_251 limit 6; ---check

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

mysql> select col_250,col_251 from tbl_39 where tbl_39.col_251 between 'Bob' and 'David' order by tbl_39.col_250,tbl_39.col_251 limit 6;
+----------------+---------+
| col_250        | col_251 |
+----------------+---------+
| gugNSTjqWSrACj | Bob     |
| HaaRdwkoeFCH   | Charlie |
| HbLx           | David   |
| kL             | Bob     |
| mvbA           | Bob     |
| ogdMlMqsYQ     | Charlie |
+----------------+---------+
6 rows in set (0.00 sec)

3. What did you see instead (Required)

mysql> select col_250,col_251 from tbl_39 where tbl_39.col_251 between 'Bob' and 'David' order by tbl_39.col_250,tbl_39.col_251 limit 6;
+----------------+---------+
| col_250        | col_251 |
+----------------+---------+
| gugNSTjqWSrACj | Bob     |
| HaaRdwkoeFCH   | Charlie |
| HbLx           | David   |
| kL             | Bob     |
| mvbA           | Bob     |
| oUHNKUlSt      | Bob     |
+----------------+---------+
6 rows in set (0.01 sec)

mysql> select col_250,col_251 from tbl_39 where tbl_39.col_251 between 'Bob' and 'David' order by tbl_39.col_250,tbl_39.col_251;
+----------------+---------+
| col_250        | col_251 |
+----------------+---------+
| gugNSTjqWSrACj | Bob     |
| HaaRdwkoeFCH   | Charlie |
| HbLx           | David   |
| kL             | Bob     |
| mvbA           | Bob     |
| ogdMlMqsYQ     | Charlie |
| oUHNKUlSt      | Bob     |
| PiPcLwhtwIAEa  | David   |
| smCLRW         | David   |
| WIVqt          | Charlie |
| xtGixNnzTa     | Bob     |
+----------------+---------+
11 rows in set (0.01 sec)

4. What is your TiDB version? (Required)

Release Version: v5.2.2
Edition: Community
Git Commit Hash: da1c21fd45a4ea5900ac16d2f4a248143f378d18
Git Branch: heads/refs/tags/v5.2.2
UTC Build Time: 2021-10-29 02:43:57
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@ChenPeng2013 ChenPeng2013 added sig/execution SIG execution 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. labels Nov 12, 2021
@XuHuaiyu XuHuaiyu added sig/sql-infra SIG: SQL Infra and removed sig/execution SIG execution labels Nov 15, 2021
@XuHuaiyu XuHuaiyu assigned bb7133 and unassigned zanmato1984 Nov 15, 2021
@xiongjiwei xiongjiwei assigned xiongjiwei and unassigned bb7133 Nov 15, 2021
@winoros winoros assigned time-and-fate and unassigned xiongjiwei Nov 15, 2021
@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.

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. severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants