diff options
author | unknown <mikael/pappa@dator5.(none)> | 2006-10-16 15:40:40 -0400 |
---|---|---|
committer | unknown <mikael/pappa@dator5.(none)> | 2006-10-16 15:40:40 -0400 |
commit | e1ff81bbce1bb71b447b754b47521db3e0cd92b0 (patch) | |
tree | 3635695d4cd8a873ae2eac0d07692901393eedfc /mysql-test | |
parent | ef9e4ab6aa8ffa5a82205ab25f099477e04a6c10 (diff) | |
parent | 93f4daf1b45f425057138b575caed00d489d002b (diff) | |
download | mariadb-git-e1ff81bbce1bb71b447b754b47521db3e0cd92b0.tar.gz |
Merge dator5.(none):/home/pappa/clean-mysql-5.1
into dator5.(none):/home/pappa/bug18198
mysql-test/r/partition.result:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/ha_partition.cc:
Auto merged
sql/ha_partition.h:
Auto merged
sql/item_func.h:
Auto merged
sql/partition_info.cc:
Auto merged
sql/sql_partition.cc:
Auto merged
sql/sql_partition.h:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/item_cmpfunc.h:
e
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/partition.result | 42 | ||||
-rw-r--r-- | mysql-test/r/partition_error.result | 24 | ||||
-rw-r--r-- | mysql-test/r/partition_hash.result | 14 | ||||
-rw-r--r-- | mysql-test/r/partition_innodb.result | 71 | ||||
-rw-r--r-- | mysql-test/r/partition_pruning.result | 12 | ||||
-rw-r--r-- | mysql-test/r/partition_range.result | 84 | ||||
-rw-r--r-- | mysql-test/t/partition-master.opt | 1 | ||||
-rw-r--r-- | mysql-test/t/partition.test | 46 | ||||
-rw-r--r-- | mysql-test/t/partition_error.test | 18 | ||||
-rw-r--r-- | mysql-test/t/partition_hash.test | 12 | ||||
-rw-r--r-- | mysql-test/t/partition_innodb.test | 68 | ||||
-rw-r--r-- | mysql-test/t/partition_pruning.test | 18 | ||||
-rw-r--r-- | mysql-test/t/partition_range.test | 78 |
13 files changed, 324 insertions, 164 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 65f3b7ebc64..f3e44a1df60 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -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)) diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index a51aaf22f69..4b01b759902 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -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, diff --git a/mysql-test/r/partition_hash.result b/mysql-test/r/partition_hash.result index 9a82a36d902..7ef3ee5c6c8 100644 --- a/mysql-test/r/partition_hash.result +++ b/mysql-test/r/partition_hash.result @@ -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; diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index f4e75ccdb05..8619d0909ee 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -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; diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index c7f1861f6b1..5fc0058356d 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -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), diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result index be88d9f6639..d39b39f413a 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -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; diff --git a/mysql-test/t/partition-master.opt b/mysql-test/t/partition-master.opt new file mode 100644 index 00000000000..b1392bfd485 --- /dev/null +++ b/mysql-test/t/partition-master.opt @@ -0,0 +1 @@ +--symbolic-links=1 diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 928d855f9f4..42fd0426d01 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -14,15 +14,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 # -- error 1064 @@ -43,27 +34,6 @@ 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 # -- error 1103 @@ -1194,22 +1164,6 @@ 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 # --error ER_PARTITION_MERGE_ERROR diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index d0e3f355292..20703b979f1 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -9,24 +9,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 # --error 1064 diff --git a/mysql-test/t/partition_hash.test b/mysql-test/t/partition_hash.test index 3304f30fb1a..d3f1a5f4892 100644 --- a/mysql-test/t/partition_hash.test +++ b/mysql-test/t/partition_hash.test @@ -10,6 +10,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 # create table t1 (a int unsigned) diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index a110fb30a3b..782e204742f 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -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; + + diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 22c15f46af4..a60846f18ff 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -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), diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test index 8719cbd98c4..84f67febe8b 100644 --- a/mysql-test/t/partition_range.test +++ b/mysql-test/t/partition_range.test @@ -10,15 +10,46 @@ drop table if exists t1; --enable_warnings # -# 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'; +# BUG 18198: Various tests for partition functions +# +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; |