48 changed files with 4929 additions and 1372 deletions
-
8mysql-test/r/partition.result
-
524mysql-test/r/partition_column.result
-
66mysql-test/r/partition_column_prune.result
-
8mysql-test/r/partition_datatype.result
-
13mysql-test/r/partition_error.result
-
24mysql-test/r/partition_innodb.result
-
11mysql-test/r/partition_list.result
-
2mysql-test/r/partition_mgm_err.result
-
329mysql-test/r/partition_pruning.result
-
93mysql-test/r/partition_range.result
-
2mysql-test/suite/parts/inc/partition_key_32col.inc
-
4mysql-test/suite/parts/inc/partition_syntax.inc
-
2mysql-test/suite/parts/r/partition_special_innodb.result
-
2mysql-test/suite/parts/r/partition_special_myisam.result
-
6mysql-test/suite/parts/r/partition_syntax_innodb.result
-
6mysql-test/suite/parts/r/partition_syntax_myisam.result
-
6mysql-test/t/partition.test
-
391mysql-test/t/partition_column.test
-
71mysql-test/t/partition_column_prune.test
-
9mysql-test/t/partition_datatype.test
-
16mysql-test/t/partition_error.test
-
30mysql-test/t/partition_innodb.test
-
2mysql-test/t/partition_list.test
-
2mysql-test/t/partition_mgm_err.test
-
20mysql-test/t/partition_pruning.test
-
72mysql-test/t/partition_range.test
-
10mysql-test/t/type_decimal.test
-
28sql/ha_ndbcluster.cc
-
154sql/ha_partition.cc
-
11sql/ha_partition.h
-
22sql/item_create.cc
-
53sql/item_timefunc.cc
-
18sql/item_timefunc.h
-
1sql/lex.h
-
7sql/mysql_priv.h
-
331sql/opt_range.cc
-
38sql/partition_element.h
-
1197sql/partition_info.cc
-
82sql/partition_info.h
-
19sql/share/errmsg-utf8.txt
-
18sql/share/errmsg.txt
-
2sql/sql_lex.cc
-
6sql/sql_lex.h
-
1961sql/sql_partition.cc
-
25sql/sql_partition.h
-
120sql/sql_show.cc
-
90sql/sql_table.cc
-
389sql/sql_yacc.yy
@ -0,0 +1,524 @@ |
|||
drop table if exists t1; |
|||
create table t1 (a varchar(1500), b varchar(1570)) |
|||
partition by list column_list(a,b) |
|||
( partition p0 values in (('a','b'))); |
|||
ERROR HY000: The total length of the partitioning fields is too large |
|||
create table t1 (a varchar(1023) character set utf8 collate utf8_spanish2_ci) |
|||
partition by range column_list(a) |
|||
( partition p0 values less than ('CZ'), |
|||
partition p1 values less than ('CH'), |
|||
partition p2 values less than ('D')); |
|||
insert into t1 values ('czz'),('chi'),('ci'),('cg'); |
|||
select * from t1 where a between 'cg' AND 'ci'; |
|||
a |
|||
ci |
|||
cg |
|||
drop table t1; |
|||
set @@sql_mode=allow_invalid_dates; |
|||
create table t1 (a char, b char, c date) |
|||
partition by range column_list (a,b,c) |
|||
( partition p0 values less than (0,0,to_days('3000-11-31'))); |
|||
ERROR HY000: Partition column values of incorrect type |
|||
create table t1 (a char, b char, c date) |
|||
partition by range column_list (a,b,c) |
|||
( partition p0 values less than (0,0,'3000-11-31')); |
|||
ERROR HY000: Partition column values of incorrect type |
|||
set @@sql_mode=''; |
|||
create table t1 (a varchar(2) character set ucs2) |
|||
partition by list column_list (a) |
|||
(partition p0 values in (0x2020), |
|||
partition p1 values in ('')); |
|||
show create table t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
/*!50100 PARTITION BY LIST COLUMN_LIST(a) |
|||
(PARTITION p0 VALUES IN (_ucs2' ') ENGINE = MyISAM, |
|||
PARTITION p1 VALUES IN (_ucs2'') ENGINE = MyISAM) */ |
|||
insert into t1 values (''); |
|||
insert into t1 values (_ucs2 0x2020); |
|||
drop table t1; |
|||
create table t1 (a int, b char(10), c varchar(25), d datetime) |
|||
partition by range column_list(a,b,c,d) |
|||
subpartition by hash (to_seconds(d)) |
|||
subpartitions 4 |
|||
( partition p0 values less than (1, 0, MAXVALUE, 0), |
|||
partition p1 values less than (1, 'a', MAXVALUE, TO_DAYS('1999-01-01')), |
|||
partition p2 values less than (1, 'a', MAXVALUE, MAXVALUE), |
|||
partition p3 values less than (1, MAXVALUE, MAXVALUE, MAXVALUE)); |
|||
select partition_method, partition_expression, partition_description |
|||
from information_schema.partitions where table_name = "t1"; |
|||
partition_method partition_expression partition_description |
|||
RANGE COLUMN_LIST a,b,c,d 1,'0',MAXVALUE,0 |
|||
RANGE COLUMN_LIST a,b,c,d 1,'0',MAXVALUE,0 |
|||
RANGE COLUMN_LIST a,b,c,d 1,'0',MAXVALUE,0 |
|||
RANGE COLUMN_LIST a,b,c,d 1,'0',MAXVALUE,0 |
|||
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,730120 |
|||
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,730120 |
|||
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,730120 |
|||
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,730120 |
|||
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,MAXVALUE |
|||
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,MAXVALUE |
|||
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,MAXVALUE |
|||
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,MAXVALUE |
|||
RANGE COLUMN_LIST a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE |
|||
RANGE COLUMN_LIST a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE |
|||
RANGE COLUMN_LIST a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE |
|||
RANGE COLUMN_LIST a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE |
|||
show create table t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` int(11) DEFAULT NULL, |
|||
`b` char(10) DEFAULT NULL, |
|||
`c` varchar(25) DEFAULT NULL, |
|||
`d` datetime DEFAULT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
/*!50100 PARTITION BY RANGE COLUMN_LIST(a,b,c,d) |
|||
SUBPARTITION BY HASH (to_seconds(d)) |
|||
SUBPARTITIONS 4 |
|||
(PARTITION p0 VALUES LESS THAN (1,_latin1'0',MAXVALUE,0) ENGINE = MyISAM, |
|||
PARTITION p1 VALUES LESS THAN (1,_latin1'a',MAXVALUE,730120) ENGINE = MyISAM, |
|||
PARTITION p2 VALUES LESS THAN (1,_latin1'a',MAXVALUE,MAXVALUE) ENGINE = MyISAM, |
|||
PARTITION p3 VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) ENGINE = MyISAM) */ |
|||
drop table t1; |
|||
create table t1 (a int, b int) |
|||
partition by range column_list (a,b) |
|||
(partition p0 values less than (NULL, maxvalue)); |
|||
ERROR HY000: Not allowed to use NULL value in VALUES LESS THAN |
|||
create table t1 (a int, b int) |
|||
partition by list column_list(a,b) |
|||
( partition p0 values in ((maxvalue, 0))); |
|||
Got one of the listed errors |
|||
create table t1 (a int, b int) |
|||
partition by list column_list (a,b) |
|||
( partition p0 values in ((0,0))); |
|||
alter table t1 add partition |
|||
(partition p1 values in (maxvalue, maxvalue)); |
|||
Got one of the listed errors |
|||
drop table t1; |
|||
create table t1 (a int, b int) |
|||
partition by key (a,a); |
|||
ERROR HY000: Duplicate partition field name 'a' |
|||
create table t1 (a int, b int) |
|||
partition by list column_list(a,a) |
|||
( partition p values in ((1,1))); |
|||
ERROR HY000: Duplicate partition field name 'a' |
|||
create table t1 (a int signed) |
|||
partition by list (a) |
|||
( partition p0 values in (1, 3, 5, 7, 9, NULL), |
|||
partition p1 values in (2, 4, 6, 8, 0)); |
|||
insert into t1 values (NULL),(0),(1),(2),(2),(4),(4),(4),(8),(8); |
|||
select * from t1 where NULL <= a; |
|||
a |
|||
select * from t1 where a is null; |
|||
a |
|||
NULL |
|||
explain partitions select * from t1 where a is null; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 Using where |
|||
select * from t1 where a <= 1; |
|||
a |
|||
1 |
|||
0 |
|||
drop table t1; |
|||
create table t1 (a int signed) |
|||
partition by list column_list(a) |
|||
( partition p0 values in (1, 3, 5, 7, 9, NULL), |
|||
partition p1 values in (2, 4, 6, 8, 0)); |
|||
insert into t1 values (NULL),(0),(1),(2),(2),(4),(4),(4),(8),(8); |
|||
select * from t1 where a <= NULL; |
|||
a |
|||
select * from t1 where a is null; |
|||
a |
|||
NULL |
|||
explain partitions select * from t1 where a is null; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where |
|||
select * from t1 where a <= 1; |
|||
a |
|||
1 |
|||
0 |
|||
drop table t1; |
|||
create table t1 (a int, b int) |
|||
partition by list column_list(a,b) |
|||
( partition p0 values in ((1, NULL), (2, NULL), (NULL, NULL)), |
|||
partition p1 values in ((1,1), (2,2)), |
|||
partition p2 values in ((3, NULL), (NULL, 1))); |
|||
select partition_method, partition_expression, partition_description |
|||
from information_schema.partitions where table_name = "t1"; |
|||
partition_method partition_expression partition_description |
|||
LIST COLUMN_LIST a,b (1,NULL),(2,NULL),(NULL,NULL) |
|||
LIST COLUMN_LIST a,b (1,1),(2,2) |
|||
LIST COLUMN_LIST a,b (3,NULL),(NULL,1) |
|||
show create table t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` int(11) DEFAULT NULL, |
|||
`b` int(11) DEFAULT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
/*!50100 PARTITION BY LIST COLUMN_LIST(a,b) |
|||
(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM, |
|||
PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM, |
|||
PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) */ |
|||
insert into t1 values (3, NULL); |
|||
insert into t1 values (NULL, 1); |
|||
insert into t1 values (NULL, NULL); |
|||
insert into t1 values (1, NULL); |
|||
insert into t1 values (2, NULL); |
|||
insert into t1 values (1,1); |
|||
insert into t1 values (2,2); |
|||
select * from t1 where a = 1; |
|||
a b |
|||
1 NULL |
|||
1 1 |
|||
select * from t1 where a = 2; |
|||
a b |
|||
2 NULL |
|||
2 2 |
|||
select * from t1 where a > 8; |
|||
a b |
|||
select * from t1 where a not between 8 and 8; |
|||
a b |
|||
2 NULL |
|||
2 2 |
|||
3 NULL |
|||
1 NULL |
|||
1 1 |
|||
show create table t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` int(11) DEFAULT NULL, |
|||
`b` int(11) DEFAULT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
/*!50100 PARTITION BY LIST COLUMN_LIST(a,b) |
|||
(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM, |
|||
PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM, |
|||
PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) */ |
|||
drop table t1; |
|||
create table t1 (a int) |
|||
partition by list (a) |
|||
( partition p0 values in (1), |
|||
partition p1 values in (1)); |
|||
ERROR HY000: Multiple definition of same constant in list partitioning |
|||
create table t1 (a int) |
|||
partition by list (a) |
|||
( partition p0 values in (2, 1), |
|||
partition p1 values in (4, NULL, 3)); |
|||
select partition_method, partition_expression, partition_description |
|||
from information_schema.partitions where table_name = "t1"; |
|||
partition_method partition_expression partition_description |
|||
LIST a 2,1 |
|||
LIST a NULL,4,3 |
|||
show create table t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` int(11) DEFAULT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
/*!50100 PARTITION BY LIST (a) |
|||
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM, |
|||
PARTITION p1 VALUES IN (NULL,4,3) ENGINE = MyISAM) */ |
|||
insert into t1 values (1); |
|||
insert into t1 values (2); |
|||
insert into t1 values (3); |
|||
insert into t1 values (4); |
|||
insert into t1 values (NULL); |
|||
insert into t1 values (5); |
|||
ERROR HY000: Table has no partition for value 5 |
|||
drop table t1; |
|||
create table t1 (a int) |
|||
partition by list column_list(a) |
|||
( partition p0 values in (2, 1), |
|||
partition p1 values in ((4), (NULL), (3))); |
|||
ERROR 42000: Row expressions in VALUES IN only allowed for multi-field column partitioning near '))' at line 4 |
|||
create table t1 (a int) |
|||
partition by list column_list(a) |
|||
( partition p0 values in (2, 1), |
|||
partition p1 values in (4, NULL, 3)); |
|||
select partition_method, partition_expression, partition_description |
|||
from information_schema.partitions where table_name = "t1"; |
|||
partition_method partition_expression partition_description |
|||
LIST COLUMN_LIST a 2,1 |
|||
LIST COLUMN_LIST a 4,NULL,3 |
|||
show create table t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` int(11) DEFAULT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
/*!50100 PARTITION BY LIST COLUMN_LIST(a) |
|||
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM, |
|||
PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) */ |
|||
insert into t1 values (1); |
|||
insert into t1 values (2); |
|||
insert into t1 values (3); |
|||
insert into t1 values (4); |
|||
insert into t1 values (NULL); |
|||
insert into t1 values (5); |
|||
ERROR HY000: Table has no partition for value from column_list |
|||
show create table t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` int(11) DEFAULT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
/*!50100 PARTITION BY LIST COLUMN_LIST(a) |
|||
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM, |
|||
PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) */ |
|||
drop table t1; |
|||
create table t1 (a int, b char(10), c varchar(5), d int) |
|||
partition by range column_list(a,b,c) |
|||
subpartition by key (c,d) |
|||
subpartitions 3 |
|||
( partition p0 values less than (1,'abc','abc'), |
|||
partition p1 values less than (2,'abc','abc'), |
|||
partition p2 values less than (3,'abc','abc'), |
|||
partition p3 values less than (4,'abc','abc')); |
|||
select partition_method, partition_expression, partition_description |
|||
from information_schema.partitions where table_name = "t1"; |
|||
partition_method partition_expression partition_description |
|||
RANGE COLUMN_LIST a,b,c 1,'abc','abc' |
|||
RANGE COLUMN_LIST a,b,c 1,'abc','abc' |
|||
RANGE COLUMN_LIST a,b,c 1,'abc','abc' |
|||
RANGE COLUMN_LIST a,b,c 2,'abc','abc' |
|||
RANGE COLUMN_LIST a,b,c 2,'abc','abc' |
|||
RANGE COLUMN_LIST a,b,c 2,'abc','abc' |
|||
RANGE COLUMN_LIST a,b,c 3,'abc','abc' |
|||
RANGE COLUMN_LIST a,b,c 3,'abc','abc' |
|||
RANGE COLUMN_LIST a,b,c 3,'abc','abc' |
|||
RANGE COLUMN_LIST a,b,c 4,'abc','abc' |
|||
RANGE COLUMN_LIST a,b,c 4,'abc','abc' |
|||
RANGE COLUMN_LIST a,b,c 4,'abc','abc' |
|||
show create table t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` int(11) DEFAULT NULL, |
|||
`b` char(10) DEFAULT NULL, |
|||
`c` varchar(5) DEFAULT NULL, |
|||
`d` int(11) DEFAULT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
/*!50100 PARTITION BY RANGE COLUMN_LIST(a,b,c) |
|||
SUBPARTITION BY KEY (c,d) |
|||
SUBPARTITIONS 3 |
|||
(PARTITION p0 VALUES LESS THAN (1,_latin1'abc',_latin1'abc') ENGINE = MyISAM, |
|||
PARTITION p1 VALUES LESS THAN (2,_latin1'abc',_latin1'abc') ENGINE = MyISAM, |
|||
PARTITION p2 VALUES LESS THAN (3,_latin1'abc',_latin1'abc') ENGINE = MyISAM, |
|||
PARTITION p3 VALUES LESS THAN (4,_latin1'abc',_latin1'abc') ENGINE = MyISAM) */ |
|||
insert into t1 values (1,'a','b',1),(2,'a','b',2),(3,'a','b',3); |
|||
insert into t1 values (1,'b','c',1),(2,'b','c',2),(3,'b','c',3); |
|||
insert into t1 values (1,'c','d',1),(2,'c','d',2),(3,'c','d',3); |
|||
insert into t1 values (1,'d','e',1),(2,'d','e',2),(3,'d','e',3); |
|||
select * from t1 where (a = 1 AND b < 'd' AND (c = 'b' OR (c = 'c' AND d = 1)) OR |
|||
(a = 1 AND b >= 'a' AND (c = 'c' OR (c = 'd' AND d = 2)))); |
|||
a b c d |
|||
1 a b 1 |
|||
1 b c 1 |
|||
drop table t1; |
|||
create table t1 (a int, b varchar(2), c int) |
|||
partition by range column_list (a, b, c) |
|||
(partition p0 values less than (1, 'A', 1), |
|||
partition p1 values less than (1, 'B', 1)); |
|||
select partition_method, partition_expression, partition_description |
|||
from information_schema.partitions where table_name = "t1"; |
|||
partition_method partition_expression partition_description |
|||
RANGE COLUMN_LIST a,b,c 1,'A',1 |
|||
RANGE COLUMN_LIST a,b,c 1,'B',1 |
|||
show create table t1; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`a` int(11) DEFAULT NULL, |
|||
`b` varchar(2) DEFAULT NULL, |
|||
`c` int(11) DEFAULT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
/*!50100 PARTITION BY RANGE COLUMN_LIST(a,b,c) |
|||
(PARTITION p0 VALUES LESS THAN (1,_latin1'A',1) ENGINE = MyISAM, |
|||
PARTITION p1 VALUES LESS THAN (1,_latin1'B',1) ENGINE = MyISAM) */ |
|||
insert into t1 values (1, 'A', 1); |
|||
explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t1 p0,p1 system NULL NULL NULL NULL 1 |
|||
select * from t1 where a = 1 AND b <= 'A' and c = 1; |
|||
a b c |
|||
1 A 1 |
|||
drop table t1; |
|||
create table t1 (a char, b char, c char) |
|||
partition by list column_list(a) |
|||
( partition p0 values in ('a')); |
|||
insert into t1 (a) values ('a'); |
|||
select * from t1 where a = 'a'; |
|||
a b c |
|||
a NULL NULL |
|||
drop table t1; |
|||
create table t1 (d time) |
|||
partition by range column_list(d) |
|||
( partition p0 values less than ('2000-01-01'), |
|||
partition p1 values less than ('2040-01-01')); |
|||
ERROR HY000: Partition column values of incorrect type |
|||
create table t1 (d timestamp) |
|||
partition by range column_list(d) |
|||
( partition p0 values less than ('2000-01-01'), |
|||
partition p1 values less than ('2040-01-01')); |
|||
ERROR HY000: Field 'd' is of a not allowed type for this type of partitioning |
|||
create table t1 (d bit(1)) |
|||
partition by range column_list(d) |
|||
( partition p0 values less than (0), |
|||
partition p1 values less than (1)); |
|||
ERROR HY000: Field 'd' is of a not allowed type for this type of partitioning |
|||
create table t1 (a int, b int) |
|||
partition by range column_list(a,b) |
|||
(partition p0 values less than (maxvalue, 10)); |
|||
drop table t1; |
|||
create table t1 (d date) |
|||
partition by range column_list(d) |
|||
( partition p0 values less than ('2000-01-01'), |
|||
partition p1 values less than ('2009-01-01')); |
|||
drop table t1; |
|||
create table t1 (d date) |
|||
partition by range column_list(d) |
|||
( partition p0 values less than ('1999-01-01'), |
|||
partition p1 values less than ('2000-01-01')); |
|||
drop table t1; |
|||
create table t1 (d date) |
|||
partition by range column_list(d) |
|||
( partition p0 values less than ('2000-01-01'), |
|||
partition p1 values less than ('3000-01-01')); |
|||
drop table t1; |
|||
create table t1 (a int, b int) |
|||
partition by range column_list(a,b) |
|||
(partition p2 values less than (99,99), |
|||
partition p1 values less than (99,999)); |
|||
insert into t1 values (99,998); |
|||
select * from t1 where b = 998; |
|||
a b |
|||
99 998 |
|||
drop table t1; |
|||
create table t1 as select to_seconds(null) as to_seconds; |
|||
select data_type from information_schema.columns |
|||
where column_name='to_seconds'; |
|||
data_type |
|||
int |
|||
drop table t1; |
|||
create table t1 (a int, b int) |
|||
partition by list column_list(a,b) |
|||
(partition p0 values in ((maxvalue,maxvalue))); |
|||
ERROR 42000: Cannot use MAXVALUE as value in VALUES IN near 'maxvalue,maxvalue)))' at line 3 |
|||
create table t1 (a int, b int) |
|||
partition by range column_list(a,b) |
|||
(partition p0 values less than (maxvalue,maxvalue)); |
|||
drop table t1; |
|||
create table t1 (a int) |
|||
partition by list column_list(a) |
|||
(partition p0 values in (0)); |
|||
select partition_method from information_schema.partitions where table_name='t1'; |
|||
partition_method |
|||
LIST COLUMN_LIST |
|||
drop table t1; |
|||
create table t1 (a char(6)) |
|||
partition by range column_list(a) |
|||
(partition p0 values less than ('H23456'), |
|||
partition p1 values less than ('M23456')); |
|||
insert into t1 values ('F23456'); |
|||
select * from t1; |
|||
a |
|||
F23456 |
|||
drop table t1; |
|||
create table t1 (a char(6)) |
|||
partition by range column_list(a) |
|||
(partition p0 values less than (H23456), |
|||
partition p1 values less than (M23456)); |
|||
ERROR 42S22: Unknown column 'H23456' in 'field list' |
|||
create table t1 (a char(6)) |
|||
partition by range column_list(a) |
|||
(partition p0 values less than (23456), |
|||
partition p1 values less than (23456)); |
|||
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition |
|||
create table t1 (a int, b int) |
|||
partition by range column_list(a,b) |
|||
(partition p0 values less than (10)); |
|||
ERROR 42000: Inconsistency in usage of column lists for partitioning near '))' at line 3 |
|||
create table t1 (a int, b int) |
|||
partition by range column_list(a,b) |
|||
(partition p0 values less than (1,1,1); |
|||
ERROR HY000: Inconsistency in usage of column lists for partitioning |
|||
create table t1 (a int, b int) |
|||
partition by range column_list(a,b) |
|||
(partition p0 values less than (1, 0), |
|||
partition p1 values less than (2, maxvalue), |
|||
partition p2 values less than (3, 3), |
|||
partition p3 values less than (10, maxvalue)); |
|||
insert into t1 values (11,0); |
|||
ERROR HY000: Table has no partition for value from column_list |
|||
insert into t1 values (0,1),(1,1),(2,1),(3,1),(3,4),(4,9),(9,1); |
|||
select * from t1; |
|||
a b |
|||
0 1 |
|||
1 1 |
|||
2 1 |
|||
3 1 |
|||
3 4 |
|||
4 9 |
|||
9 1 |
|||
alter table t1 |
|||
partition by range column_list(b,a) |
|||
(partition p0 values less than (1,2), |
|||
partition p1 values less than (3,3), |
|||
partition p2 values less than (9,5)); |
|||
explain partitions select * from t1 where b < 2; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 7 Using where |
|||
select * from t1 where b < 2; |
|||
a b |
|||
0 1 |
|||
1 1 |
|||
2 1 |
|||
3 1 |
|||
9 1 |
|||
explain partitions select * from t1 where b < 4; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 7 Using where |
|||
select * from t1 where b < 4; |
|||
a b |
|||
0 1 |
|||
1 1 |
|||
2 1 |
|||
3 1 |
|||
9 1 |
|||
alter table t1 reorganize partition p1 into |
|||
(partition p11 values less than (2,2), |
|||
partition p12 values less than (3,3)); |
|||
alter table t1 reorganize partition p0 into |
|||
(partition p01 values less than (0,3), |
|||
partition p02 values less than (1,1)); |
|||
ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range |
|||
alter table t1 reorganize partition p2 into |
|||
(partition p2 values less than(9,6,1)); |
|||
ERROR HY000: Inconsistency in usage of column lists for partitioning |
|||
alter table t1 reorganize partition p2 into |
|||
(partition p2 values less than (10)); |
|||
ERROR HY000: Inconsistency in usage of column lists for partitioning |
|||
alter table t1 reorganize partition p2 into |
|||
(partition p21 values less than (4,7), |
|||
partition p22 values less than (9,5)); |
|||
explain partitions select * from t1 where b < 4; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t1 p0,p11,p12,p21 ALL NULL NULL NULL NULL 7 Using where |
|||
select * from t1 where b < 4; |
|||
a b |
|||
0 1 |
|||
1 1 |
|||
2 1 |
|||
3 1 |
|||
9 1 |
|||
drop table t1; |
|||
create table t1 (a int, b int) |
|||
partition by list column_list(a,b) |
|||
subpartition by hash (b) |
|||
subpartitions 2 |
|||
(partition p0 values in ((0,0), (1,1)), |
|||
partition p1 values in ((1000,1000))); |
|||
insert into t1 values (1000,1000); |
|||
drop table t1; |
|||
create table t1 (a char, b char, c char) |
|||
partition by range column_list(a,b,c) |
|||
( partition p0 values less than ('a','b','c')); |
|||
alter table t1 add partition |
|||
(partition p1 values less than ('b','c','d')); |
|||
drop table t1; |
|||
@ -0,0 +1,66 @@ |
|||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; |
|||
create table t1 (a char, b char, c char) |
|||
partition by range column_list(a,b,c) |
|||
( partition p0 values less than ('a','b','c')); |
|||
insert into t1 values ('a', NULL, 'd'); |
|||
explain partitions select * from t1 where a = 'a' AND c = 'd'; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 |
|||
select * from t1 where a = 'a' AND c = 'd'; |
|||
a b c |
|||
a NULL d |
|||
drop table t1; |
|||
create table t1 (a int not null) partition by range column_list(a) ( |
|||
partition p0 values less than (10), |
|||
partition p1 values less than (20), |
|||
partition p2 values less than (30), |
|||
partition p3 values less than (40), |
|||
partition p4 values less than (50), |
|||
partition p5 values less than (60), |
|||
partition p6 values less than (70) |
|||
); |
|||
insert into t1 values (5),(15),(25),(35),(45),(55),(65); |
|||
insert into t1 values (5),(15),(25),(35),(45),(55),(65); |
|||
create table t2 (a int not null) partition by range(a) ( |
|||
partition p0 values less than (10), |
|||
partition p1 values less than (20), |
|||
partition p2 values less than (30), |
|||
partition p3 values less than (40), |
|||
partition p4 values less than (50), |
|||
partition p5 values less than (60), |
|||
partition p6 values less than (70) |
|||
); |
|||
insert into t2 values (5),(15),(25),(35),(45),(55),(65); |
|||
insert into t2 values (5),(15),(25),(35),(45),(55),(65); |
|||
explain partitions select * from t1 where a > 35 and a < 45; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t1 p3,p4 ALL NULL NULL NULL NULL 4 Using where |
|||
explain partitions select * from t2 where a > 35 and a < 45; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 4 Using where |
|||
drop table t1, t2; |
|||
create table t1 (a int not null, b int not null ) |
|||
partition by range column_list(a,b) ( |
|||
partition p01 values less than (2,10), |
|||
partition p02 values less than (2,20), |
|||
partition p03 values less than (2,30), |
|||
partition p11 values less than (4,10), |
|||
partition p12 values less than (4,20), |
|||
partition p13 values less than (4,30), |
|||
partition p21 values less than (6,10), |
|||
partition p22 values less than (6,20), |
|||
partition p23 values less than (6,30) |
|||
); |
|||
insert into t1 values (2,5), (2,15), (2,25), |
|||
(4,5), (4,15), (4,25), (6,5), (6,15), (6,25); |
|||
insert into t1 select * from t1; |
|||
explain partitions select * from t1 where a=2; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t1 p01,p02,p03,p11 ALL NULL NULL NULL NULL 13 Using where |
|||
explain partitions select * from t1 where a=4; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t1 p11,p12,p13,p21 ALL NULL NULL NULL NULL 16 Using where |
|||
explain partitions select * from t1 where a=2 and b < 22; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t1 p01,p02,p03 ALL NULL NULL NULL NULL 16 Using where |
|||
drop table t1; |
|||
@ -0,0 +1,391 @@ |
|||
# |
|||
# Tests for the new column list partitioning introduced in second |
|||
# version for partitioning. |
|||
# |
|||
--source include/have_partition.inc |
|||
|
|||
--disable_warnings |
|||
drop table if exists t1; |
|||
--enable_warnings |
|||
|
|||
# |
|||
# BUG#48164, too long partition fields causes crash |
|||
# |
|||
--error ER_PARTITION_FIELDS_TOO_LONG |
|||
create table t1 (a varchar(1500), b varchar(1570)) |
|||
partition by list column_list(a,b) |
|||
( partition p0 values in (('a','b'))); |
|||
|
|||
create table t1 (a varchar(1023) character set utf8 collate utf8_spanish2_ci) |
|||
partition by range column_list(a) |
|||
( partition p0 values less than ('CZ'), |
|||
partition p1 values less than ('CH'), |
|||
partition p2 values less than ('D')); |
|||
insert into t1 values ('czz'),('chi'),('ci'),('cg'); |
|||
select * from t1 where a between 'cg' AND 'ci'; |
|||
drop table t1; |
|||
|
|||
# |
|||
# BUG#48165, sql_mode gives error |
|||
# |
|||
set @@sql_mode=allow_invalid_dates; |
|||
--error ER_WRONG_TYPE_COLUMN_VALUE_ERROR |
|||
create table t1 (a char, b char, c date) |
|||
partition by range column_list (a,b,c) |
|||
( partition p0 values less than (0,0,to_days('3000-11-31'))); |
|||
|
|||
--error ER_WRONG_TYPE_COLUMN_VALUE_ERROR |
|||
create table t1 (a char, b char, c date) |
|||
partition by range column_list (a,b,c) |
|||
( partition p0 values less than (0,0,'3000-11-31')); |
|||
set @@sql_mode=''; |
|||
|
|||
# |
|||
# BUG#48163, Dagger in UCS2 not working as partition value |
|||
# |
|||
create table t1 (a varchar(2) character set ucs2) |
|||
partition by list column_list (a) |
|||
(partition p0 values in (0x2020), |
|||
partition p1 values in ('')); |
|||
show create table t1; |
|||
insert into t1 values (''); |
|||
insert into t1 values (_ucs2 0x2020); |
|||
drop table t1; |
|||
|
|||
create table t1 (a int, b char(10), c varchar(25), d datetime) |
|||
partition by range column_list(a,b,c,d) |
|||
subpartition by hash (to_seconds(d)) |
|||
subpartitions 4 |
|||
( partition p0 values less than (1, 0, MAXVALUE, 0), |
|||
partition p1 values less than (1, 'a', MAXVALUE, TO_DAYS('1999-01-01')), |
|||
partition p2 values less than (1, 'a', MAXVALUE, MAXVALUE), |
|||
partition p3 values less than (1, MAXVALUE, MAXVALUE, MAXVALUE)); |
|||
select partition_method, partition_expression, partition_description |
|||
from information_schema.partitions where table_name = "t1"; |
|||
show create table t1; |
|||
drop table t1; |
|||
|
|||
--error ER_NULL_IN_VALUES_LESS_THAN |
|||
create table t1 (a int, b int) |
|||
partition by range column_list (a,b) |
|||
(partition p0 values less than (NULL, maxvalue)); |
|||
|
|||
--error ER_MAXVALUE_IN_VALUES_IN, ER_PARSE_ERROR |
|||
create table t1 (a int, b int) |
|||
partition by list column_list(a,b) |
|||
( partition p0 values in ((maxvalue, 0))); |
|||
|
|||
create table t1 (a int, b int) |
|||
partition by list column_list (a,b) |
|||
( partition p0 values in ((0,0))); |
|||
--error ER_MAXVALUE_IN_VALUES_IN, ER_PARSE_ERROR |
|||
alter table t1 add partition |
|||
(partition p1 values in (maxvalue, maxvalue)); |
|||
drop table t1; |
|||
# |
|||
# BUG#47837, Crash when two same fields in column list processing |
|||
# |
|||
--error ER_SAME_NAME_PARTITION_FIELD |
|||
create table t1 (a int, b int) |
|||
partition by key (a,a); |
|||
--error ER_SAME_NAME_PARTITION_FIELD |
|||
create table t1 (a int, b int) |
|||
partition by list column_list(a,a) |
|||
( partition p values in ((1,1))); |
|||
|
|||
# |
|||
# BUG#47838, List partitioning have problems with <= and >= |
|||
# |
|||
create table t1 (a int signed) |
|||
partition by list (a) |
|||
( partition p0 values in (1, 3, 5, 7, 9, NULL), |
|||
partition p1 values in (2, 4, 6, 8, 0)); |
|||
insert into t1 values (NULL),(0),(1),(2),(2),(4),(4),(4),(8),(8); |
|||
select * from t1 where NULL <= a; |
|||
select * from t1 where a is null; |
|||
explain partitions select * from t1 where a is null; |
|||
select * from t1 where a <= 1; |
|||
drop table t1; |
|||
|
|||
create table t1 (a int signed) |
|||
partition by list column_list(a) |
|||
( partition p0 values in (1, 3, 5, 7, 9, NULL), |
|||
partition p1 values in (2, 4, 6, 8, 0)); |
|||
insert into t1 values (NULL),(0),(1),(2),(2),(4),(4),(4),(8),(8); |
|||
select * from t1 where a <= NULL; |
|||
select * from t1 where a is null; |
|||
explain partitions select * from t1 where a is null; |
|||
select * from t1 where a <= 1; |
|||
drop table t1; |
|||
|
|||
create table t1 (a int, b int) |
|||
partition by list column_list(a,b) |
|||
( partition p0 values in ((1, NULL), (2, NULL), (NULL, NULL)), |
|||
partition p1 values in ((1,1), (2,2)), |
|||
partition p2 values in ((3, NULL), (NULL, 1))); |
|||
select partition_method, partition_expression, partition_description |
|||
from information_schema.partitions where table_name = "t1"; |
|||
show create table t1; |
|||
# |
|||
# BUG#47754 Crash when selecting using NOT BETWEEN for column list partitioning |
|||
# |
|||
insert into t1 values (3, NULL); |
|||
insert into t1 values (NULL, 1); |
|||
insert into t1 values (NULL, NULL); |
|||
insert into t1 values (1, NULL); |
|||
insert into t1 values (2, NULL); |
|||
insert into t1 values (1,1); |
|||
insert into t1 values (2,2); |
|||
select * from t1 where a = 1; |
|||
select * from t1 where a = 2; |
|||
select * from t1 where a > 8; |
|||
select * from t1 where a not between 8 and 8; |
|||
show create table t1; |
|||
drop table t1; |
|||
|
|||
--error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR |
|||
create table t1 (a int) |
|||
partition by list (a) |
|||
( partition p0 values in (1), |
|||
partition p1 values in (1)); |
|||
|
|||
create table t1 (a int) |
|||
partition by list (a) |
|||
( partition p0 values in (2, 1), |
|||
partition p1 values in (4, NULL, 3)); |
|||
select partition_method, partition_expression, partition_description |
|||
from information_schema.partitions where table_name = "t1"; |
|||
show create table t1; |
|||
insert into t1 values (1); |
|||
insert into t1 values (2); |
|||
insert into t1 values (3); |
|||
insert into t1 values (4); |
|||
insert into t1 values (NULL); |
|||
--error ER_NO_PARTITION_FOR_GIVEN_VALUE |
|||
insert into t1 values (5); |
|||
drop table t1; |
|||
|
|||
--error ER_PARSE_ERROR |
|||
create table t1 (a int) |
|||
partition by list column_list(a) |
|||
( partition p0 values in (2, 1), |
|||
partition p1 values in ((4), (NULL), (3))); |
|||
|
|||
create table t1 (a int) |
|||
partition by list column_list(a) |
|||
( partition p0 values in (2, 1), |
|||
partition p1 values in (4, NULL, 3)); |
|||
select partition_method, partition_expression, partition_description |
|||
from information_schema.partitions where table_name = "t1"; |
|||
show create table t1; |
|||
insert into t1 values (1); |
|||
insert into t1 values (2); |
|||
insert into t1 values (3); |
|||
insert into t1 values (4); |
|||
insert into t1 values (NULL); |
|||
--error ER_NO_PARTITION_FOR_GIVEN_VALUE |
|||
insert into t1 values (5); |
|||
show create table t1; |
|||
drop table t1; |
|||
|
|||
create table t1 (a int, b char(10), c varchar(5), d int) |
|||
partition by range column_list(a,b,c) |
|||
subpartition by key (c,d) |
|||
subpartitions 3 |
|||
( partition p0 values less than (1,'abc','abc'), |
|||
partition p1 values less than (2,'abc','abc'), |
|||
partition p2 values less than (3,'abc','abc'), |
|||
partition p3 values less than (4,'abc','abc')); |
|||
select partition_method, partition_expression, partition_description |
|||
from information_schema.partitions where table_name = "t1"; |
|||
show create table t1; |
|||
|
|||
insert into t1 values (1,'a','b',1),(2,'a','b',2),(3,'a','b',3); |
|||
insert into t1 values (1,'b','c',1),(2,'b','c',2),(3,'b','c',3); |
|||
insert into t1 values (1,'c','d',1),(2,'c','d',2),(3,'c','d',3); |
|||
insert into t1 values (1,'d','e',1),(2,'d','e',2),(3,'d','e',3); |
|||
select * from t1 where (a = 1 AND b < 'd' AND (c = 'b' OR (c = 'c' AND d = 1)) OR |
|||
(a = 1 AND b >= 'a' AND (c = 'c' OR (c = 'd' AND d = 2)))); |
|||
drop table t1; |
|||
|
|||
create table t1 (a int, b varchar(2), c int) |
|||
partition by range column_list (a, b, c) |
|||
(partition p0 values less than (1, 'A', 1), |
|||
partition p1 values less than (1, 'B', 1)); |
|||
select partition_method, partition_expression, partition_description |
|||
from information_schema.partitions where table_name = "t1"; |
|||
show create table t1; |
|||
insert into t1 values (1, 'A', 1); |
|||
explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1; |
|||
select * from t1 where a = 1 AND b <= 'A' and c = 1; |
|||
drop table t1; |
|||
|
|||
create table t1 (a char, b char, c char) |
|||
partition by list column_list(a) |
|||
( partition p0 values in ('a')); |
|||
insert into t1 (a) values ('a'); |
|||
select * from t1 where a = 'a'; |
|||
drop table t1; |
|||
|
|||
--error ER_WRONG_TYPE_COLUMN_VALUE_ERROR |
|||
create table t1 (d time) |
|||
partition by range column_list(d) |
|||
( partition p0 values less than ('2000-01-01'), |
|||
partition p1 values less than ('2040-01-01')); |
|||
|
|||
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD |
|||
create table t1 (d timestamp) |
|||
partition by range column_list(d) |
|||
( partition p0 values less than ('2000-01-01'), |
|||
partition p1 values less than ('2040-01-01')); |
|||
|
|||
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD |
|||
create table t1 (d bit(1)) |
|||
partition by range column_list(d) |
|||
( partition p0 values less than (0), |
|||
partition p1 values less than (1)); |
|||
|
|||
create table t1 (a int, b int) |
|||
partition by range column_list(a,b) |
|||
(partition p0 values less than (maxvalue, 10)); |
|||
drop table t1; |
|||
|
|||
create table t1 (d date) |
|||
partition by range column_list(d) |
|||
( partition p0 values less than ('2000-01-01'), |
|||
partition p1 values less than ('2009-01-01')); |
|||
drop table t1; |
|||
|
|||
create table t1 (d date) |
|||
partition by range column_list(d) |
|||
( partition p0 values less than ('1999-01-01'), |
|||
partition p1 values less than ('2000-01-01')); |
|||
drop table t1; |
|||
|
|||
create table t1 (d date) |
|||
partition by range column_list(d) |
|||
( partition p0 values less than ('2000-01-01'), |
|||
partition p1 values less than ('3000-01-01')); |
|||
drop table t1; |
|||
|
|||
create table t1 (a int, b int) |
|||
partition by range column_list(a,b) |
|||
(partition p2 values less than (99,99), |
|||
partition p1 values less than (99,999)); |
|||
|
|||
insert into t1 values (99,998); |
|||
select * from t1 where b = 998; |
|||
drop table t1; |
|||
|
|||
create table t1 as select to_seconds(null) as to_seconds; |
|||
select data_type from information_schema.columns |
|||
where column_name='to_seconds'; |
|||
drop table t1; |
|||
|
|||
--error ER_PARSE_ERROR |
|||
create table t1 (a int, b int) |
|||
partition by list column_list(a,b) |
|||
(partition p0 values in ((maxvalue,maxvalue))); |
|||
create table t1 (a int, b int) |
|||
partition by range column_list(a,b) |
|||
(partition p0 values less than (maxvalue,maxvalue)); |
|||
drop table t1; |
|||
|
|||
create table t1 (a int) |
|||
partition by list column_list(a) |
|||
(partition p0 values in (0)); |
|||
select partition_method from information_schema.partitions where table_name='t1'; |
|||
drop table t1; |
|||
|
|||
create table t1 (a char(6)) |
|||
partition by range column_list(a) |
|||
(partition p0 values less than ('H23456'), |
|||
partition p1 values less than ('M23456')); |
|||
insert into t1 values ('F23456'); |
|||
select * from t1; |
|||
drop table t1; |
|||
|
|||
-- error 1054 |
|||
create table t1 (a char(6)) |
|||
partition by range column_list(a) |
|||
(partition p0 values less than (H23456), |
|||
partition p1 values less than (M23456)); |
|||
|
|||
-- error ER_RANGE_NOT_INCREASING_ERROR |
|||
create table t1 (a char(6)) |
|||
partition by range column_list(a) |
|||
(partition p0 values less than (23456), |
|||
partition p1 values less than (23456)); |
|||
|
|||
-- error 1064 |
|||
create table t1 (a int, b int) |
|||
partition by range column_list(a,b) |
|||
(partition p0 values less than (10)); |
|||
|
|||
-- error ER_PARTITION_COLUMN_LIST_ERROR |
|||
create table t1 (a int, b int) |
|||
partition by range column_list(a,b) |
|||
(partition p0 values less than (1,1,1); |
|||
|
|||
create table t1 (a int, b int) |
|||
partition by range column_list(a,b) |
|||
(partition p0 values less than (1, 0), |
|||
partition p1 values less than (2, maxvalue), |
|||
partition p2 values less than (3, 3), |
|||
partition p3 values less than (10, maxvalue)); |
|||
|
|||
-- error ER_NO_PARTITION_FOR_GIVEN_VALUE |
|||
insert into t1 values (11,0); |
|||
insert into t1 values (0,1),(1,1),(2,1),(3,1),(3,4),(4,9),(9,1); |
|||
select * from t1; |
|||
|
|||
alter table t1 |
|||
partition by range column_list(b,a) |
|||
(partition p0 values less than (1,2), |
|||
partition p1 values less than (3,3), |
|||
partition p2 values less than (9,5)); |
|||
explain partitions select * from t1 where b < 2; |
|||
select * from t1 where b < 2; |
|||
explain partitions select * from t1 where b < 4; |
|||
select * from t1 where b < 4; |
|||
|
|||
alter table t1 reorganize partition p1 into |
|||
(partition p11 values less than (2,2), |
|||
partition p12 values less than (3,3)); |
|||
|
|||
-- error ER_REORG_OUTSIDE_RANGE |
|||
alter table t1 reorganize partition p0 into |
|||
(partition p01 values less than (0,3), |
|||
partition p02 values less than (1,1)); |
|||
|
|||
-- error ER_PARTITION_COLUMN_LIST_ERROR |
|||
alter table t1 reorganize partition p2 into |
|||
(partition p2 values less than(9,6,1)); |
|||
|
|||
-- error ER_PARTITION_COLUMN_LIST_ERROR |
|||
alter table t1 reorganize partition p2 into |
|||
(partition p2 values less than (10)); |
|||
|
|||
alter table t1 reorganize partition p2 into |
|||
(partition p21 values less than (4,7), |
|||
partition p22 values less than (9,5)); |
|||
explain partitions select * from t1 where b < 4; |
|||
select * from t1 where b < 4; |
|||
drop table t1; |
|||
|
|||
create table t1 (a int, b int) |
|||
partition by list column_list(a,b) |
|||
subpartition by hash (b) |
|||
subpartitions 2 |
|||
(partition p0 values in ((0,0), (1,1)), |
|||
partition p1 values in ((1000,1000))); |
|||
insert into t1 values (1000,1000); |
|||
#select * from t1 where a = 0 and b = 0; |
|||
drop table t1; |
|||
|
|||
create table t1 (a char, b char, c char) |
|||
partition by range column_list(a,b,c) |
|||
( partition p0 values less than ('a','b','c')); |
|||
alter table t1 add partition |
|||
(partition p1 values less than ('b','c','d')); |
|||
drop table t1; |
|||
@ -0,0 +1,71 @@ |
|||
# |
|||
# Partition pruning tests for new COLUMN LIST feature |
|||
# |
|||
-- source include/have_partition.inc |
|||
|
|||
--disable_warnings |
|||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; |
|||
--enable_warnings |
|||
|
|||
create table t1 (a char, b char, c char) |
|||
partition by range column_list(a,b,c) |
|||
( partition p0 values less than ('a','b','c')); |
|||
insert into t1 values ('a', NULL, 'd'); |
|||
explain partitions select * from t1 where a = 'a' AND c = 'd'; |
|||
select * from t1 where a = 'a' AND c = 'd'; |
|||
drop table t1; |
|||
|
|||
## COLUMN_LIST partition pruning tests |
|||
create table t1 (a int not null) partition by range column_list(a) ( |
|||
partition p0 values less than (10), |
|||
partition p1 values less than (20), |
|||
partition p2 values less than (30), |
|||
partition p3 values less than (40), |
|||
partition p4 values less than (50), |
|||
partition p5 values less than (60), |
|||
partition p6 values less than (70) |
|||
); |
|||
insert into t1 values (5),(15),(25),(35),(45),(55),(65); |
|||
insert into t1 values (5),(15),(25),(35),(45),(55),(65); |
|||
|
|||
create table t2 (a int not null) partition by range(a) ( |
|||
partition p0 values less than (10), |
|||
partition p1 values less than (20), |
|||
partition p2 values less than (30), |
|||
partition p3 values less than (40), |
|||
partition p4 values less than (50), |
|||
partition p5 values less than (60), |
|||
partition p6 values less than (70) |
|||
); |
|||
insert into t2 values (5),(15),(25),(35),(45),(55),(65); |
|||
insert into t2 values (5),(15),(25),(35),(45),(55),(65); |
|||
|
|||
explain partitions select * from t1 where a > 35 and a < 45; |
|||
explain partitions select * from t2 where a > 35 and a < 45; |
|||
|
|||
drop table t1, t2; |
|||
|
|||
create table t1 (a int not null, b int not null ) |
|||
partition by range column_list(a,b) ( |
|||
partition p01 values less than (2,10), |
|||
partition p02 values less than (2,20), |
|||
partition p03 values less than (2,30), |
|||
|
|||
partition p11 values less than (4,10), |
|||
partition p12 values less than (4,20), |
|||
partition p13 values less than (4,30), |
|||
|
|||
partition p21 values less than (6,10), |
|||
partition p22 values less than (6,20), |
|||
partition p23 values less than (6,30) |
|||
); |
|||
|
|||
insert into t1 values (2,5), (2,15), (2,25), |
|||
(4,5), (4,15), (4,25), (6,5), (6,15), (6,25); |
|||
insert into t1 select * from t1; |
|||
|
|||
explain partitions select * from t1 where a=2; |
|||
explain partitions select * from t1 where a=4; |
|||
explain partitions select * from t1 where a=2 and b < 22; |
|||
|
|||
drop table t1; |
|||
1197
sql/partition_info.cc
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1961
sql/sql_partition.cc
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue