Skip to content

Commit

Permalink
ddl: increasing value of partition by range columns fix (#32748) (#33643
Browse files Browse the repository at this point in the history
)

close #32748
  • Loading branch information
mjonss committed Apr 1, 2022
1 parent f5965a1 commit 6fe68d6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
15 changes: 15 additions & 0 deletions ddl/db_partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,13 @@ create table log_message_1 (
"partition p1 values less than ('G'));",
dbterror.ErrRangeNotIncreasing,
},
{
"create table t(a char(10) collate utf8mb4_bin) " +
"partition by range columns (a) (" +
"partition p0 values less than ('g'), " +
"partition p1 values less than ('A'));",
dbterror.ErrRangeNotIncreasing,
},
{
"CREATE TABLE t1(c0 INT) PARTITION BY HASH((NOT c0)) PARTITIONS 2;",
dbterror.ErrPartitionFunctionIsNotAllowed,
Expand Down Expand Up @@ -617,6 +624,14 @@ create table log_message_1 (
partition p0 values less than ('a'),
partition p1 values less than ('G'));`)

tk.MustExec("drop table if exists t;")
tk.MustExec(`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))`)

tk.MustExec("drop table if exists t;")
tk.MustExec(`create table t(a int) partition by range columns (a) (
partition p0 values less than (10),
Expand Down
5 changes: 0 additions & 5 deletions ddl/ddl_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2681,11 +2681,6 @@ func checkTwoRangeColumns(ctx sessionctx.Context, curr, prev *model.PartitionDef
return false, nil
}

// Current and previous is the same.
if strings.EqualFold(curr.LessThan[i], prev.LessThan[i]) {
continue
}

// The tuples of column values used to define the partitions are strictly increasing:
// PARTITION p0 VALUES LESS THAN (5,10,'ggg')
// PARTITION p1 VALUES LESS THAN (10,20,'mmm')
Expand Down

0 comments on commit 6fe68d6

Please sign in to comment.