diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/partition_error.result | 17 | ||||
-rw-r--r-- | mysql-test/r/partition_pruning.result | 12 | ||||
-rw-r--r-- | mysql-test/r/partition_range.result | 42 | ||||
-rw-r--r-- | mysql-test/t/partition.test | 9 | ||||
-rw-r--r-- | mysql-test/t/partition_error.test | 22 | ||||
-rw-r--r-- | mysql-test/t/partition_pruning.test | 18 | ||||
-rw-r--r-- | mysql-test/t/partition_range.test | 29 |
7 files changed, 124 insertions, 25 deletions
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index a51aaf22f69..6ded066c3ec 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -1,5 +1,22 @@ drop table if exists t1; create table t1 (a int) +partition by range (a) +(partition p0 values less than ((select count(*) from t1))); +ERROR HY000: This partition function is not allowed +create table t1 (a int) +partition by range (a) +(partition p0 values less than (a); +ERROR 42S22: Unknown column 'a' in 'partition function' +create table t1 (a int) +partition by range (a) +(partition p0 values less than (1)); +alter table t1 add partition (partition p1 values less than (a)); +ERROR 42S22: Unknown column 'a' in 'partition function' +alter table t1 add partition +(partition p1 values less than ((select count(*) from t1))); +ERROR HY000: This partition function is not allowed +drop table t1; +create table t1 (a int) engine = x partition by key (a); Warnings: 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..99f29fa4156 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -719,3 +719,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.test b/mysql-test/t/partition.test index 928d855f9f4..488d2ccda3f 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 diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index d0e3f355292..a9efbc587be 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -9,6 +9,28 @@ drop table if exists t1; --enable_warnings # +# Bug 18198: Partitions: Too flexible functions +# +-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int) +partition by range (a) +(partition p0 values less than ((select count(*) from t1))); +-- error 1054 +create table t1 (a int) +partition by range (a) +(partition p0 values less than (a); + +create table t1 (a int) +partition by range (a) +(partition p0 values less than (1)); +-- error 1054 +alter table t1 add partition (partition p1 values less than (a)); +-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED +alter table t1 add partition +(partition p1 values less than ((select count(*) from t1))); +drop table t1; + +# # Bug 20397: Partitions: Crash when using non-existing engine # create table t1 (a int) 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..6a4d61864e0 100644 --- a/mysql-test/t/partition_range.test +++ b/mysql-test/t/partition_range.test @@ -699,3 +699,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; |