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

partition by RANGE COLUMNS (varchar_bin_collation_col) not using the correct collation for checking increasing partition values #32748

Closed
mjonss opened this issue Mar 2, 2022 · 2 comments · Fixed by #33643
Labels
component/tablepartition This issue is related to Table Partition of TiDB. may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. severity/minor sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@mjonss
Copy link
Contributor

mjonss commented Mar 2, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t (a varchar(255) charset utf8mb4 collate utf8mb4_bin) partition by range columns (a) (partition pnull values less than (""), partition puppera values less than ("AAA"), partition plowera values less than ("aaa"), partition pmax values less than (MAXVALUE));

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

mysql> create table t (a varchar(255) charset utf8mb4 collate utf8mb4_bin) partition by range columns (a) (partition pnull values less than (""), partition puppera values less than ("AAA"), partition plowera values less than ("aaa"), partition pmax values less than (MAXVALUE));
Query OK, 0 rows affected (0,07 sec)

3. What did you see instead (Required)

tidb> create table t (a varchar(255) charset utf8mb4 collate utf8mb4_bin) partition by range columns (a) (partition pnull values less than (""), partition puppera values less than ("AAA"), partition plowera values less than ("aaa"), partition pmax values less than (MAXVALUE));
ERROR 1493 (HY000): VALUES LESS THAN value must be strictly increasing for each partition

4. What is your TiDB version? (Required)

Release Version: v5.5.0-alpha-442-gfbfe36ca7d
Edition: Community
Git Commit Hash: fbfe36ca7dd3a78a714872d468cebfce34e50116
Git Branch: master
UTC Build Time: 2022-03-02 11:21:12
GoVersion: go1.17
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@mjonss mjonss added the type/bug The issue is confirmed as a bug. label Mar 2, 2022
@mjonss
Copy link
Contributor Author

mjonss commented Mar 2, 2022

/component tablepartition

@ti-chi-bot ti-chi-bot added the component/tablepartition This issue is related to Table Partition of TiDB. label Mar 2, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. labels Mar 3, 2022
@bb7133
Copy link
Member

bb7133 commented Mar 11, 2022

The root cause is here:

if strings.EqualFold(curr.LessThan[i], prev.LessThan[i]) {

It gives a case-insensitive comparison between AAA and aaa, it has been introduced in a long time. IMHO it is not a big issue in most of the cases. I will lower its severity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/tablepartition This issue is related to Table Partition of TiDB. may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. severity/minor 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.

4 participants