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

CREATE partitioned table fails check for unsigned int column definition #35827

Closed
mjonss opened this issue Jun 29, 2022 · 3 comments · Fixed by #36830
Closed

CREATE partitioned table fails check for unsigned int column definition #35827

mjonss opened this issue Jun 29, 2022 · 3 comments · Fixed by #36830
Assignees
Labels
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. affects-6.0 affects-6.1 affects-6.2 good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. may-affects-4.0 This bug maybe affects 4.0.x versions. severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@mjonss
Copy link
Contributor

mjonss commented Jun 29, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t (id tinyint unsigned, idpart tinyint, i varchar(255)) partition by range (idpart) (partition p1 values less than (-1));

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

mysql> create table t (id tinyint unsigned, idpart tinyint, i varchar(255)) partition by range (idpart) (partition p1 values less than (-1));
Query OK, 0 rows affected (0,03 sec)

3. What did you see instead (Required)

tidb> create table t (id tinyint unsigned, idpart tinyint, i varchar(255)) partition by range (idpart) (partition p1 values less than (-1));
ERROR 1563 (HY000): Partition constant is out of partition function domain

4. What is your TiDB version? (Required)

tidb_version(): Release Version: v6.2.0-alpha-230-g47a4f3a017
Edition: Community
Git Commit Hash: 47a4f3a017768dda0b9a826451486c5539bc8427
Git Branch: master
UTC Build Time: 2022-06-29 19:09:58
GoVersion: go1.18
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
Store: unistore
@mjonss mjonss added the type/bug The issue is confirmed as a bug. label Jun 29, 2022
@mjonss
Copy link
Contributor Author

mjonss commented Jun 29, 2022

Issue is in the isColUnsigned function.

@mjonss mjonss added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Jun 29, 2022
@ChenPeng2013 ChenPeng2013 added sig/sql-infra SIG: SQL Infra severity/major 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. affects-6.0 affects-6.1 labels Jun 30, 2022
@ti-chi-bot ti-chi-bot added the may-affects-4.0 This bug maybe affects 4.0.x versions. label Jun 30, 2022
@ymkzpx
Copy link
Contributor

ymkzpx commented Jun 30, 2022

/assign

@mjonss
Copy link
Contributor Author

mjonss commented Jun 30, 2022

I don't think this is a major issue, maybe moderate. The issue is checking column names with strings.Contains(strings.ToLower(pi.Expr), col.Name.L) meaning if any other column is a substring of the partitioning column and is unsigned, the function will return true (that the partition column is unsigned) during CREATE/ALTER TABLE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. affects-6.0 affects-6.1 affects-6.2 good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. may-affects-4.0 This bug maybe affects 4.0.x versions. severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
4 participants