Commit 4b4b8f93 authored by mikael@zim.(none)'s avatar mikael@zim.(none)

Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  zim.(none):/home/mikael/bug17127
parents 741b14a0 0ec5ee2c
...@@ -423,6 +423,33 @@ x123 11,12 1 ...@@ -423,6 +423,33 @@ x123 11,12 1
x234 NULL,1 1 x234 NULL,1 1
drop table t1; drop table t1;
create table t1 (a int) create table t1 (a int)
(partition p0 values less than (1));
alter table t1 add partition (partition p1 values in (2));
ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
alter table t1 add partition (partition p1);
ERROR HY000: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition
drop table t1;
create table t1 (a int)
partition by list (a)
(partition p0 values in (1));
alter table t1 add partition (partition p1 values less than (2));
ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
alter table t1 add partition (partition p1);
ERROR HY000: LIST PARTITIONING requires definition of VALUES IN for each partition
drop table t1;
create table t1 (a int)
partition by hash (a)
(partition p0);
alter table t1 add partition (partition p1 values less than (2));
ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
alter table t1 add partition (partition p1 values in (2));
ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
drop table t1;
create table t1 (a int)
partition by list (a)
(partition p0 values in (1));
alter table t1 rebuild partition;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
partition by list (a) partition by list (a)
(partition p0 values in (1)); (partition p0 values in (1));
alter table t1 rebuild partition; alter table t1 rebuild partition;
......
...@@ -540,6 +540,42 @@ select partition_name, partition_description, table_rows ...@@ -540,6 +540,42 @@ select partition_name, partition_description, table_rows
from information_schema.partitions where table_schema ='test'; from information_schema.partitions where table_schema ='test';
drop table t1; drop table t1;
#
# Bug 17127
#
create table t1 (a int)
partition by range (a)
(partition p0 values less than (1));
--error ER_PARTITION_WRONG_VALUES_ERROR
alter table t1 add partition (partition p1 values in (2));
--error ER_PARTITION_REQUIRES_VALUES_ERROR
alter table t1 add partition (partition p1);
drop table t1;
create table t1 (a int)
partition by list (a)
(partition p0 values in (1));
--error ER_PARTITION_WRONG_VALUES_ERROR
alter table t1 add partition (partition p1 values less than (2));
--error ER_PARTITION_REQUIRES_VALUES_ERROR
alter table t1 add partition (partition p1);
drop table t1;
create table t1 (a int)
partition by hash (a)
(partition p0);
--error ER_PARTITION_WRONG_VALUES_ERROR
alter table t1 add partition (partition p1 values less than (2));
--error ER_PARTITION_WRONG_VALUES_ERROR
alter table t1 add partition (partition p1 values in (2));
drop table t1;
# #
# BUG 17947 Crash with REBUILD PARTITION # BUG 17947 Crash with REBUILD PARTITION
# #
......
...@@ -4135,6 +4135,35 @@ uint prep_alter_part_table(THD *thd, TABLE *table, ALTER_INFO *alter_info, ...@@ -4135,6 +4135,35 @@ uint prep_alter_part_table(THD *thd, TABLE *table, ALTER_INFO *alter_info,
((flags & (HA_FAST_CHANGE_PARTITION | HA_PARTITION_ONE_PHASE)) != 0); ((flags & (HA_FAST_CHANGE_PARTITION | HA_PARTITION_ONE_PHASE)) != 0);
DBUG_PRINT("info", ("*fast_alter_partition: %d flags: 0x%x", DBUG_PRINT("info", ("*fast_alter_partition: %d flags: 0x%x",
*fast_alter_partition, flags)); *fast_alter_partition, flags));
if (((alter_info->flags & ALTER_ADD_PARTITION) ||
(alter_info->flags & ALTER_REORGANIZE_PARTITION)) &&
(thd->lex->part_info->part_type != tab_part_info->part_type) &&
(thd->lex->part_info->part_type != NOT_A_PARTITION))
{
if (thd->lex->part_info->part_type == RANGE_PARTITION)
{
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"RANGE", "LESS THAN");
}
else if (thd->lex->part_info->part_type == LIST_PARTITION)
{
DBUG_ASSERT(thd->lex->part_info->part_type == LIST_PARTITION);
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"LIST", "IN");
}
else if (tab_part_info->part_type == RANGE_PARTITION)
{
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
"RANGE", "LESS THAN");
}
else
{
DBUG_ASSERT(tab_part_info->part_type == LIST_PARTITION);
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
"LIST", "IN");
}
DBUG_RETURN(TRUE);
}
if (alter_info->flags & ALTER_ADD_PARTITION) if (alter_info->flags & ALTER_ADD_PARTITION)
{ {
/* /*
......
...@@ -3663,6 +3663,8 @@ opt_part_values: ...@@ -3663,6 +3663,8 @@ opt_part_values:
YYABORT; YYABORT;
} }
} }
else
lex->part_info->part_type= HASH_PARTITION;
} }
| VALUES LESS_SYM THAN_SYM part_func_max | VALUES LESS_SYM THAN_SYM part_func_max
{ {
...@@ -3676,6 +3678,8 @@ opt_part_values: ...@@ -3676,6 +3678,8 @@ opt_part_values:
YYABORT; YYABORT;
} }
} }
else
lex->part_info->part_type= RANGE_PARTITION;
} }
| VALUES IN_SYM '(' part_list_func ')' | VALUES IN_SYM '(' part_list_func ')'
{ {
...@@ -3689,6 +3693,8 @@ opt_part_values: ...@@ -3689,6 +3693,8 @@ opt_part_values:
YYABORT; YYABORT;
} }
} }
else
lex->part_info->part_type= LIST_PARTITION;
} }
; ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment