# This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2008/01/28 16:11:43+01:00 mikael@dator6.(none) # BUG#33429: No check for maxvalue before adding partition # # mysql-test/r/partition_range.result # 2008/01/28 16:11:40+01:00 mikael@dator6.(none) +11 -0 # Added new test cases # # mysql-test/t/partition_range.test # 2008/01/28 16:11:40+01:00 mikael@dator6.(none) +11 -0 # Added new test cases # # sql/sql_partition.cc # 2008/01/28 16:11:40+01:00 mikael@dator6.(none) +6 -1 # Added check that last partition hasn't got maxvalue defined when # executing ADD PARTITION # diff -Nru a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result --- a/mysql-test/r/partition_range.result 2008-01-28 16:12:37 +01:00 +++ b/mysql-test/r/partition_range.result 2008-01-28 16:12:37 +01:00 @@ -1,4 +1,15 @@ drop table if exists t1, t2; +create table t1 (a int) +partition by range (a) +( partition p0 values less than (maxvalue)); +alter table t1 add partition (partition p1 values less than (100000)); +ERROR HY000: MAXVALUE can only be used in last partition definition +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ +drop table t1; create table t1 (a int unsigned) partition by range (a) (partition pnull values less than (0), diff -Nru a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test --- a/mysql-test/t/partition_range.test 2008-01-28 16:12:37 +01:00 +++ b/mysql-test/t/partition_range.test 2008-01-28 16:12:37 +01:00 @@ -10,6 +10,17 @@ --enable_warnings # +# BUG 33429: Succeeds in adding partition when maxvalue on last partition +# +create table t1 (a int) +partition by range (a) +( partition p0 values less than (maxvalue)); +--error ER_PARTITION_MAXVALUE_ERROR +alter table t1 add partition (partition p1 values less than (100000)); +show create table t1; +drop table t1; + +# # BUG 18198: Various tests for partition functions # #create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int) diff -Nru a/sql/sql_partition.cc b/sql/sql_partition.cc --- a/sql/sql_partition.cc 2008-01-28 16:12:37 +01:00 +++ b/sql/sql_partition.cc 2008-01-28 16:12:37 +01:00 @@ -4313,7 +4313,12 @@ { my_error(ER_NO_BINLOG_ERROR, MYF(0)); DBUG_RETURN(TRUE); - } + } + if (tab_part_info->defined_max_value) + { + my_error(ER_PARTITION_MAXVALUE_ERROR, MYF(0)); + DBUG_RETURN(TRUE); + } if (no_new_partitions == 0) { my_error(ER_ADD_PARTITION_NO_NEW_PARTITION, MYF(0));