mirror of
https://github.com/MariaDB/server.git
synced 2025-11-10 23:02:54 +03:00
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.1
into mysql.com:/windows/Linux_space/MySQL/mysql-5.1
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (s1 char(2) character set utf8)
|
||||
partition by list (case when s1 > 'cz' then 1 else 2 end)
|
||||
(partition p1 values in (1),
|
||||
partition p2 values in (2));
|
||||
drop table t1;
|
||||
create table t1 (a int)
|
||||
partition by key(a)
|
||||
partitions 0.2+e1;
|
||||
@@ -21,32 +16,6 @@ partition by key(a)
|
||||
partitions 1e+300;
|
||||
ERROR 42000: Only integers allowed as number here near '1e+300' at line 3
|
||||
create table t1 (a int)
|
||||
engine = innodb
|
||||
partition by key (a);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
insert into t1 values (0), (1), (2), (3);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 4 4096 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
drop table t1;
|
||||
create table t1 (a int auto_increment primary key)
|
||||
engine = innodb
|
||||
partition by key (a);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 2 8192 16384 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
insert into t1 values (NULL), (NULL), (NULL), (NULL);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 4 4096 16384 0 0 0 5 NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
insert into t1 values (NULL), (NULL), (NULL), (NULL);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 8 2048 16384 0 0 0 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
drop table t1;
|
||||
create table t1 (a int)
|
||||
partition by key (a)
|
||||
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
|
||||
ERROR 42000: Incorrect table name 'part-data'
|
||||
@@ -1042,17 +1011,6 @@ set session sql_mode='';
|
||||
drop table t1;
|
||||
create table t1 (a int)
|
||||
partition by key (a)
|
||||
(partition p1 engine = innodb);
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
drop table t1;
|
||||
create table t1 (a int)
|
||||
partition by key (a)
|
||||
(partition p0 engine = MERGE);
|
||||
ERROR HY000: Engine cannot be used in partitioned tables
|
||||
create table t1 (a varchar(1))
|
||||
|
||||
@@ -1,28 +1,4 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (a int)
|
||||
engine = x
|
||||
partition by key (a);
|
||||
Warnings:
|
||||
Error 1286 Unknown table engine 'x'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */
|
||||
drop table t1;
|
||||
create table t1 (a int)
|
||||
engine = innodb
|
||||
partition by list (a)
|
||||
(partition p0 values in (0));
|
||||
alter table t1 engine = x;
|
||||
Warnings:
|
||||
Error 1286 Unknown table engine 'x'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0) ENGINE = InnoDB) */
|
||||
drop table t1;
|
||||
partition by list (a)
|
||||
partitions 3
|
||||
(partition x1 values in (1,2,9,4) tablespace ts1,
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin)
|
||||
partition by hash(length(a))
|
||||
partitions 10;
|
||||
insert into t1 values (''),(' '),('a'),('a '),('a ');
|
||||
explain partitions select * from t1 where a='a ';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
|
||||
explain partitions select * from t1 where a='a';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
|
||||
explain partitions select * from t1 where a='a ' OR a='a';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
|
||||
drop table t1;
|
||||
create table t1 (a int unsigned)
|
||||
partition by hash(a div 2)
|
||||
partitions 4;
|
||||
|
||||
@@ -3,3 +3,74 @@ show table status like 't1';
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
drop table t1;
|
||||
create table t1 (a int)
|
||||
engine = innodb
|
||||
partition by key (a);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
insert into t1 values (0), (1), (2), (3);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 4 4096 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
drop table t1;
|
||||
create table t1 (a int auto_increment primary key)
|
||||
engine = innodb
|
||||
partition by key (a);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 2 8192 16384 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
insert into t1 values (NULL), (NULL), (NULL), (NULL);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 4 4096 16384 0 0 0 5 NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
insert into t1 values (NULL), (NULL), (NULL), (NULL);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 8 2048 16384 0 0 0 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
drop table t1;
|
||||
create table t1 (a int)
|
||||
partition by key (a)
|
||||
(partition p1 engine = innodb);
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
drop table t1;
|
||||
create table t1 (a date)
|
||||
engine = innodb
|
||||
partition by range (year(a))
|
||||
(partition p0 values less than (2006),
|
||||
partition p1 values less than (2007));
|
||||
explain partitions select * from t1
|
||||
where a between '2006-01-01' and '2007-06-01';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
|
||||
drop table t1;
|
||||
create table t1 (a int)
|
||||
engine = x
|
||||
partition by key (a);
|
||||
Warnings:
|
||||
Error 1286 Unknown table engine 'x'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */
|
||||
drop table t1;
|
||||
create table t1 (a int)
|
||||
engine = innodb
|
||||
partition by list (a)
|
||||
(partition p0 values in (0));
|
||||
alter table t1 engine = x;
|
||||
Warnings:
|
||||
Error 1286 Unknown table engine 'x'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0) ENGINE = InnoDB) */
|
||||
drop table t1;
|
||||
|
||||
@@ -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
|
||||
)
|
||||
@@ -683,8 +676,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),
|
||||
|
||||
@@ -1,13 +1,37 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (a date)
|
||||
engine = innodb
|
||||
partition by range (year(a))
|
||||
(partition p0 values less than (2006),
|
||||
partition p1 values less than (2007));
|
||||
explain partitions select * from t1
|
||||
where a between '2006-01-01' and '2007-06-01';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
|
||||
partition by range (length(a) * b)
|
||||
(partition p0 values less than (2), partition p1 values less than (400));
|
||||
insert into t1 values ('a ', 2),('a',3);
|
||||
drop table t1;
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
|
||||
partition by range (b* length(a) * b)
|
||||
(partition p0 values less than (2), partition p1 values less than (400));
|
||||
insert into t1 values ('a ', 2),('a',3);
|
||||
drop table t1;
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
|
||||
b varchar(10) charset latin1 collate latin1_bin)
|
||||
partition by range (length(b) * length(a))
|
||||
(partition p0 values less than (2), partition p1 values less than (400));
|
||||
insert into t1 values ('a ', 'b '),('a','b');
|
||||
drop table t1;
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
|
||||
b varchar(10) charset latin1 collate latin1_bin)
|
||||
partition by range (length(a) * length(b))
|
||||
(partition p0 values less than (2), partition p1 values less than (400));
|
||||
insert into t1 values ('a ', 'b '),('a','b');
|
||||
drop table t1;
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
|
||||
b varchar(10) charset latin1 collate latin1_bin, c int)
|
||||
partition by range (length(a) * c)
|
||||
(partition p0 values less than (2), partition p1 values less than (400));
|
||||
insert into t1 values ('a ', 'b ', 2),('a','b', 3);
|
||||
drop table t1;
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
|
||||
b varchar(10) charset latin1 collate latin1_bin, c int)
|
||||
partition by range (c * length(a))
|
||||
(partition p0 values less than (2), partition p1 values less than (400));
|
||||
insert into t1 values ('a ', 'b ', 2),('a','b', 3);
|
||||
drop table t1;
|
||||
create table t1 (a int unsigned)
|
||||
partition by range (a)
|
||||
@@ -719,3 +743,45 @@ WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p407,p408,p409,p507,p508,p509 ALL NULL NULL NULL NULL 18 Using where
|
||||
DROP TABLE t1;
|
||||
create table t1 (a varchar(20))
|
||||
partition by range (crc32(md5(a)))
|
||||
(partition p0 values less than (100),
|
||||
partition p1 values less than maxvalue);
|
||||
insert into t1 values ("12345678901234567890");
|
||||
insert into t1 values ("A2345678901234567890");
|
||||
insert into t1 values ("B2345678901234567890");
|
||||
insert into t1 values ("1234567890123456789");
|
||||
insert into t1 values ("1234567890123456");
|
||||
select * from t1;
|
||||
a
|
||||
12345678901234567890
|
||||
A2345678901234567890
|
||||
B2345678901234567890
|
||||
1234567890123456789
|
||||
1234567890123456
|
||||
explain partitions select * from t1 where a = "12345678901234567890";
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 5 Using where
|
||||
explain partitions select * from t1 where a = "12345678901234567890" OR
|
||||
a = "A2345678901234567890" OR
|
||||
a = "B2345678901234567890" OR
|
||||
a = "C2345678901234567890";
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 5 Using where
|
||||
explain partitions select * from t1 where a = "01234567890123456";
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 5 Using where
|
||||
select * from t1 where a = "01234567890123456";
|
||||
a
|
||||
select * from t1 where a = "12345678901234567890" OR
|
||||
a = "A2345678901234567890" OR
|
||||
a = "B2345678901234567890" OR
|
||||
a = "C2345678901234567890";
|
||||
a
|
||||
12345678901234567890
|
||||
A2345678901234567890
|
||||
B2345678901234567890
|
||||
select * from t1 where a = "12345678901234567890";
|
||||
a
|
||||
12345678901234567890
|
||||
drop table t1;
|
||||
|
||||
1
mysql-test/t/partition-master.opt
Normal file
1
mysql-test/t/partition-master.opt
Normal file
@@ -0,0 +1 @@
|
||||
--symbolic-links=1
|
||||
@@ -13,15 +13,6 @@
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug#14367: Partitions: crash if utf8 column
|
||||
#
|
||||
create table t1 (s1 char(2) character set utf8)
|
||||
partition by list (case when s1 > 'cz' then 1 else 2 end)
|
||||
(partition p1 values in (1),
|
||||
partition p2 values in (2));
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug 15890: Strange number of partitions accepted
|
||||
#
|
||||
@@ -42,27 +33,6 @@ create table t1 (a int)
|
||||
partition by key(a)
|
||||
partitions 1e+300;
|
||||
|
||||
#
|
||||
# Bug 21173: SHOW TABLE STATUS crashes server in InnoDB
|
||||
#
|
||||
create table t1 (a int)
|
||||
engine = innodb
|
||||
partition by key (a);
|
||||
show table status;
|
||||
insert into t1 values (0), (1), (2), (3);
|
||||
show table status;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int auto_increment primary key)
|
||||
engine = innodb
|
||||
partition by key (a);
|
||||
show table status;
|
||||
insert into t1 values (NULL), (NULL), (NULL), (NULL);
|
||||
show table status;
|
||||
insert into t1 values (NULL), (NULL), (NULL), (NULL);
|
||||
show table status;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug 21350: Data Directory problems
|
||||
#
|
||||
@@ -1193,22 +1163,6 @@ show create table t1;
|
||||
set session sql_mode='';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG 19122 Crash after ALTER TABLE t1 REBUILD PARTITION p1
|
||||
#
|
||||
create table t1 (a int)
|
||||
partition by key (a)
|
||||
(partition p1 engine = innodb);
|
||||
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG 19304 Partitions: MERGE handler not allowed in partitioned tables
|
||||
#
|
||||
|
||||
@@ -8,24 +8,6 @@
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug 20397: Partitions: Crash when using non-existing engine
|
||||
#
|
||||
create table t1 (a int)
|
||||
engine = x
|
||||
partition by key (a);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int)
|
||||
engine = innodb
|
||||
partition by list (a)
|
||||
(partition p0 values in (0));
|
||||
|
||||
alter table t1 engine = x;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Partition by key stand-alone error
|
||||
#
|
||||
|
||||
@@ -9,6 +9,18 @@
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# BUG 18198: Partition functions handling
|
||||
#
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin)
|
||||
partition by hash(length(a))
|
||||
partitions 10;
|
||||
insert into t1 values (''),(' '),('a'),('a '),('a ');
|
||||
explain partitions select * from t1 where a='a ';
|
||||
explain partitions select * from t1 where a='a';
|
||||
explain partitions select * from t1 where a='a ' OR a='a';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# More partition pruning tests, especially on interval walking
|
||||
#
|
||||
|
||||
@@ -8,3 +8,71 @@ create table t1 (a int) engine=innodb partition by hash(a) ;
|
||||
show table status like 't1';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug 21173: SHOW TABLE STATUS crashes server in InnoDB
|
||||
#
|
||||
create table t1 (a int)
|
||||
engine = innodb
|
||||
partition by key (a);
|
||||
show table status;
|
||||
insert into t1 values (0), (1), (2), (3);
|
||||
show table status;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int auto_increment primary key)
|
||||
engine = innodb
|
||||
partition by key (a);
|
||||
show table status;
|
||||
insert into t1 values (NULL), (NULL), (NULL), (NULL);
|
||||
show table status;
|
||||
insert into t1 values (NULL), (NULL), (NULL), (NULL);
|
||||
show table status;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG 19122 Crash after ALTER TABLE t1 REBUILD PARTITION p1
|
||||
#
|
||||
create table t1 (a int)
|
||||
partition by key (a)
|
||||
(partition p1 engine = innodb);
|
||||
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
alter table t1 rebuild partition p1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug 21339: Crash in Explain Partitions
|
||||
#
|
||||
create table t1 (a date)
|
||||
engine = innodb
|
||||
partition by range (year(a))
|
||||
(partition p0 values less than (2006),
|
||||
partition p1 values less than (2007));
|
||||
explain partitions select * from t1
|
||||
where a between '2006-01-01' and '2007-06-01';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug 20397: Partitions: Crash when using non-existing engine
|
||||
#
|
||||
create table t1 (a int)
|
||||
engine = x
|
||||
partition by key (a);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int)
|
||||
engine = innodb
|
||||
partition by list (a)
|
||||
(partition p0 values in (0));
|
||||
|
||||
alter table t1 engine = x;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
|
||||
@@ -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:
|
||||
@@ -535,8 +538,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),
|
||||
|
||||
@@ -10,15 +10,46 @@ drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug 21339: Crash in Explain Partitions
|
||||
# BUG 18198: Various tests for partition functions
|
||||
#
|
||||
create table t1 (a date)
|
||||
engine = innodb
|
||||
partition by range (year(a))
|
||||
(partition p0 values less than (2006),
|
||||
partition p1 values less than (2007));
|
||||
explain partitions select * from t1
|
||||
where a between '2006-01-01' and '2007-06-01';
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
|
||||
partition by range (length(a) * b)
|
||||
(partition p0 values less than (2), partition p1 values less than (400));
|
||||
insert into t1 values ('a ', 2),('a',3);
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
|
||||
partition by range (b* length(a) * b)
|
||||
(partition p0 values less than (2), partition p1 values less than (400));
|
||||
insert into t1 values ('a ', 2),('a',3);
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
|
||||
b varchar(10) charset latin1 collate latin1_bin)
|
||||
partition by range (length(b) * length(a))
|
||||
(partition p0 values less than (2), partition p1 values less than (400));
|
||||
insert into t1 values ('a ', 'b '),('a','b');
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
|
||||
b varchar(10) charset latin1 collate latin1_bin)
|
||||
partition by range (length(a) * length(b))
|
||||
(partition p0 values less than (2), partition p1 values less than (400));
|
||||
insert into t1 values ('a ', 'b '),('a','b');
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
|
||||
b varchar(10) charset latin1 collate latin1_bin, c int)
|
||||
partition by range (length(a) * c)
|
||||
(partition p0 values less than (2), partition p1 values less than (400));
|
||||
insert into t1 values ('a ', 'b ', 2),('a','b', 3);
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
|
||||
b varchar(10) charset latin1 collate latin1_bin, c int)
|
||||
partition by range (c * length(a))
|
||||
(partition p0 values less than (2), partition p1 values less than (400));
|
||||
insert into t1 values ('a ', 'b ', 2),('a','b', 3);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
@@ -699,3 +730,32 @@ WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
|
||||
(a >= '2005-07-01' AND a <= '2005-09-30');
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug 18198: Try with a couple of cases using VARCHAR fields in
|
||||
# partition function.
|
||||
create table t1 (a varchar(20))
|
||||
partition by range (crc32(md5(a)))
|
||||
(partition p0 values less than (100),
|
||||
partition p1 values less than maxvalue);
|
||||
|
||||
insert into t1 values ("12345678901234567890");
|
||||
insert into t1 values ("A2345678901234567890");
|
||||
insert into t1 values ("B2345678901234567890");
|
||||
insert into t1 values ("1234567890123456789");
|
||||
insert into t1 values ("1234567890123456");
|
||||
select * from t1;
|
||||
explain partitions select * from t1 where a = "12345678901234567890";
|
||||
explain partitions select * from t1 where a = "12345678901234567890" OR
|
||||
a = "A2345678901234567890" OR
|
||||
a = "B2345678901234567890" OR
|
||||
a = "C2345678901234567890";
|
||||
explain partitions select * from t1 where a = "01234567890123456";
|
||||
select * from t1 where a = "01234567890123456";
|
||||
select * from t1 where a = "12345678901234567890" OR
|
||||
a = "A2345678901234567890" OR
|
||||
a = "B2345678901234567890" OR
|
||||
a = "C2345678901234567890";
|
||||
select * from t1 where a = "12345678901234567890";
|
||||
|
||||
|
||||
drop table t1;
|
||||
|
||||
Reference in New Issue
Block a user