-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
ddl: fix creating partition table with unique prefix index #17196
Conversation
ddl/partition.go
Outdated
@@ -761,6 +763,15 @@ func checkPartitioningKeysConstraints(sctx sessionctx.Context, s *ast.CreateTabl | |||
return nil | |||
} | |||
|
|||
func hasPrefixIndexColumn(idxCols []*model.IndexColumn) bool { | |||
for _, col := range idxCols { | |||
if col.Length > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check the table name too?
Below sql will execute sucessfull in Mysql but faild in This PR:
create table part12 (a varchar(20), b varchar(10), unique index (a(5),b)) partition by range columns (b) (
partition p0 values less than ('aaaaa'),
partition p1 values less than ('bbbbb'),
partition p2 values less than ('ccccc'))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Codecov Report
@@ Coverage Diff @@
## master #17196 +/- ##
===========================================
Coverage 80.1515% 80.1515%
===========================================
Files 511 511
Lines 140137 140137
===========================================
Hits 112322 112322
Misses 18855 18855
Partials 8960 8960 |
a3571a0
to
b0fcc28
Compare
/run-all-tests |
cherry pick to release-4.0 in PR #17213 |
Signed-off-by: sre-bot <sre-bot@pingcap.com>
cherry pick to release-3.0 in PR #17214 |
cherry pick to release-3.1 in PR #17215 |
What problem does this PR solve?
MySQL: A UNIQUE INDEX must include all columns in the table's partitioning function
TiDB: no error
Problem Summary:
Unique prefix index can't be used on the partition table.
What is changed and how it works?
Proposal: xxx
What's Changed:
How it Works:
Add check
Related changes
Check List
Tests
Release note