BUG#18198: More fixes

parent d870e355
......@@ -750,11 +750,6 @@ t2 CREATE TABLE `t2` (
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment' /*!50100 PARTITION BY KEY (a) */
drop table t2;
create table t1 (s1 char(2) character set utf8)
partition by list (cast(s1 as signed))
(partition p1 values in (1),
partition p2 values in (2));
drop table t1;
create table t1 (f1 int) partition by hash (f1) as select 1;
drop table t1;
prepare stmt1 from 'create table t1 (s1 int) partition by hash (s1)';
......
......@@ -641,7 +641,7 @@ ERROR HY000: Partition constant is out of partition function domain
create table t1 (v varchar(12))
partition by range (ascii(v))
(partition p0 values less than (10));
drop table t1;
ERROR HY000: This partition function is not allowed
create table t1 (a int)
partition by hash (rand(a));
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
......
......@@ -284,13 +284,6 @@ explain partitions select * from t9 where a <= '2004-12-19';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t9 p0,p1 ALL NULL NULL NULL NULL 2 Using where
drop table t5,t6,t7,t8,t9;
create table t1 (a enum('a','b','c','d') default 'a')
partition by hash (ascii(a)) partitions 2;
insert into t1 values ('a'),('b'),('c');
explain partitions select * from t1 where a='b';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 3 Using where
drop table t1;
create table t1 (
a1 int not null
)
......@@ -643,8 +636,9 @@ f_int1 f_int2
8 8
9 9
drop table t1;
create table t1 (a char(10)) partition by list(length(a)) (
partition p1 values in (1),
create table t1 (a char(10) binary)
partition by list(length(a))
(partition p1 values in (1),
partition p2 values in (2),
partition p3 values in (3),
partition p4 values in (4),
......
......@@ -883,11 +883,13 @@ drop table t2;
#
# Bug#14367: Partitions: crash if utf8 column
#
create table t1 (s1 char(2) character set utf8)
partition by list (cast(s1 as signed))
(partition p1 values in (1),
partition p2 values in (2));
drop table t1;
# utf columns not supported after Bug #18198 is fixed
#
#create table t1 (s1 char(2) character set utf8)
#partition by list (cast(s1 as signed))
#(partition p1 values in (1),
# partition p2 values in (2));
#drop table t1;
#
# Bug#15336 Partitions: crash if create table as select
......
......@@ -809,10 +809,10 @@ partition by range (a)
#
# Bug 18198 Partitions: Verify that erroneus partition functions doesn't work
#
-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
create table t1 (v varchar(12))
partition by range (ascii(v))
(partition p0 values less than (10));
drop table t1;
-- error 1064
create table t1 (a int)
......
......@@ -238,11 +238,14 @@ explain partitions select * from t9 where a <= '2004-12-19';
drop table t5,t6,t7,t8,t9;
# Test the case where we can't create partitioning 'index'
create table t1 (a enum('a','b','c','d') default 'a')
partition by hash (ascii(a)) partitions 2;
insert into t1 values ('a'),('b'),('c');
explain partitions select * from t1 where a='b';
drop table t1;
#
# Not supported after bug#18198 is fixed
#
#create table t1 (a enum('a','b','c','d') default 'a')
# partition by hash (ascii(a)) partitions 2;
#insert into t1 values ('a'),('b'),('c');
#explain partitions select * from t1 where a='b';
#drop table t1;
#
# Test cases for bugs found in code review:
......@@ -519,8 +522,9 @@ select * from t1 where f_int1 between 5 and 15 order by f_int1;
drop table t1;
# part2: bug in pruning code
create table t1 (a char(10)) partition by list(length(a)) (
partition p1 values in (1),
create table t1 (a char(10) binary)
partition by list(length(a))
(partition p1 values in (1),
partition p2 values in (2),
partition p3 values in (3),
partition p4 values in (4),
......
......@@ -1553,8 +1553,11 @@ bool fix_partition_func(THD *thd, TABLE *table,
goto end;
}
}
if ((check_part_func_fields(part_info->part_field_array)) ||
(part_info->is_sub_partitioned() &&
if (((part_info->part_type != HASH_PARTITION ||
part_info->list_of_part_fields == FALSE) &&
check_part_func_fields(part_info->part_field_array)) ||
(part_info->list_of_part_fields == FALSE &&
part_info->is_sub_partitioned() &&
check_part_func_fields(part_info->subpart_field_array)))
{
my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
......
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