Skip to content

Commit

Permalink
cherry pick pingcap#36345 to release-5.4
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
u5surf authored and ti-srebot committed Jul 21, 2022
1 parent ef81f12 commit ecafe23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions ddl/db_partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,14 @@ create table log_message_1 (
"partition p1 values less than ('G'));",
ddl.ErrRangeNotIncreasing,
},
{
"create table t(d datetime)" +
"partition by range columns (d) (" +
"partition p0 values less than ('2022-01-01')," +
"partition p1 values less than (MAXVALUE), " +
"partition p2 values less than (MAXVALUE));",
dbterror.ErrRangeNotIncreasing,
},
{
"CREATE TABLE t1(c0 INT) PARTITION BY HASH((NOT c0)) PARTITIONS 2;",
ddl.ErrPartitionFunctionIsNotAllowed,
Expand Down
2 changes: 1 addition & 1 deletion ddl/ddl_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2319,7 +2319,7 @@ func checkTwoRangeColumns(ctx sessionctx.Context, curr, prev *model.PartitionDef
}
for i := 0; i < len(pi.Columns); i++ {
// Special handling for MAXVALUE.
if strings.EqualFold(curr.LessThan[i], partitionMaxValue) {
if strings.EqualFold(curr.LessThan[i], partitionMaxValue) && !strings.EqualFold(prev.LessThan[i], partitionMaxValue) {
// If current is maxvalue, it certainly >= previous.
return true, nil
}
Expand Down

0 comments on commit ecafe23

Please sign in to comment.