summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/partition_bug18198.result205
-rw-r--r--mysql-test/t/partition_bug18198.test252
-rw-r--r--mysql-test/t/partition_charset.test7
-rw-r--r--mysql-test/t/partition_list.test4
4 files changed, 468 insertions, 0 deletions
diff --git a/mysql-test/r/partition_bug18198.result b/mysql-test/r/partition_bug18198.result
new file mode 100644
index 00000000000..091de9fb853
--- /dev/null
+++ b/mysql-test/r/partition_bug18198.result
@@ -0,0 +1,205 @@
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+create table t1 (a char(5) character set koi8r)
+partition by list (ascii(a) mod 3)
+subpartition by hash(ascii(a))
+subpartitions 3
+(partition p1 values in (1),
+partition p2 values in (2),
+partition p0 values in (0));
+insert into t1 values ('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 p2_p2sp2 system NULL NULL NULL NULL 1
+select * from t1 where a = 'a';
+a
+a
+drop table t1;
+create table t1 (a char(5) character set cp1251)
+partition by list (ascii(a)) (partition pn values in (null));
+drop table t1;
+create table t1 (col1 datetime)
+partition by range(datediff(col1,col1))
+(partition p0 values less than (10), partition p1 values less than (30));
+drop table t1;
+create table t1 (a char(5) character set big5)
+partition by list (ascii(a)) (partition pn values in (null));
+ERROR HY000: This partition function is not allowed
+create table t1 (a char(1))
+partition by list(ascii(a))
+(partition p1 values in (ascii('i')));
+drop table t1;
+create table t1 (s1 char(5) character set latin5)
+partition by list (ascii(s1))
+(partition p1 values in (1));
+set names utf8;
+drop table t1;
+create table t1 (col1 int)
+partition by range(greatest(col1,10))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(isnull(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(least(col1,12))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(case when col1>0 then 10 else 20 end)
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(ifnull(col1,5))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(nullif(col1,5))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(bit_length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 char(5))
+partition by range(bit_length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(char_length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 char(5))
+partition by range(char_length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 char(5))
+partition by range(character_length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(find_in_set(col1,1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 char(5))
+partition by range(find_in_set(col1,'1'))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(instr(col1,3))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 char(5))
+partition by range(instr(col1,'3'))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 char(5))
+partition by range(length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 char(5))
+partition by range(locate(1,col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(locate(1,col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 char(5))
+partition by range(octet_length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 char(5))
+partition by range(position(1 in col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(position(1 in col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 char(5))
+partition by range(strcmp(col1,2))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(strcmp(col1,2))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(crc32(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(round(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(sign(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 datetime)
+partition by range(period_add(col1,5))
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 datetime, col2 datetime)
+partition by range(period_diff(col1,col2))
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int, col2 int)
+partition by range(period_diff(col1,col2))
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 datetime)
+partition by range(timestampdiff(day,5,col1))
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 date)
+partition by range(unix_timestamp(col1))
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 datetime)
+partition by range(week(col1))
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 varchar(25))
+partition by range(cast(col1 as signed))
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 varchar(25))
+partition by range(convert(col1,unsigned))
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(col1 | 20)
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(col1 & 20)
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(col1 ^ 20)
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(col1 << 20)
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(col1 >> 20)
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(~col1)
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(bit_count(col1))
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
+create table t1 (col1 int)
+partition by range(inet_aton(col1))
+(partition p0 values less than (10), partition p1 values less than (30));
+ERROR HY000: This partition function is not allowed
diff --git a/mysql-test/t/partition_bug18198.test b/mysql-test/t/partition_bug18198.test
new file mode 100644
index 00000000000..2d36ea4665e
--- /dev/null
+++ b/mysql-test/t/partition_bug18198.test
@@ -0,0 +1,252 @@
+-- source include/have_partition.inc
+--disable warnings
+drop table if exists t1;
+--enable warnings
+
+create table t1 (a char(5) character set koi8r)
+partition by list (ascii(a) mod 3)
+subpartition by hash(ascii(a))
+subpartitions 3
+(partition p1 values in (1),
+ partition p2 values in (2),
+ partition p0 values in (0));
+insert into t1 values ('a');
+explain partitions select * from t1 where a = 'a';
+select * from t1 where a = 'a';
+drop table t1;
+
+create table t1 (a char(5) character set cp1251)
+partition by list (ascii(a)) (partition pn values in (null));
+drop table t1;
+
+create table t1 (col1 datetime)
+partition by range(datediff(col1,col1))
+(partition p0 values less than (10), partition p1 values less than (30));
+drop table t1;
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (a char(5) character set big5)
+partition by list (ascii(a)) (partition pn values in (null));
+
+create table t1 (a char(1))
+partition by list(ascii(a))
+(partition p1 values in (ascii('i')));
+#insert into t1 values ('i');
+drop table t1;
+
+create table t1 (s1 char(5) character set latin5)
+partition by list (ascii(s1))
+(partition p1 values in (1));
+set names utf8;
+#insert into tn values ('żż');
+drop table t1;
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(greatest(col1,10))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(isnull(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(least(col1,12))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(case when col1>0 then 10 else 20 end)
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(ifnull(col1,5))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(nullif(col1,5))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(bit_length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 char(5))
+partition by range(bit_length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(char_length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 char(5))
+partition by range(char_length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 char(5))
+partition by range(character_length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(find_in_set(col1,1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 char(5))
+partition by range(find_in_set(col1,'1'))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(instr(col1,3))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 char(5))
+partition by range(instr(col1,'3'))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 char(5))
+partition by range(length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 char(5))
+partition by range(locate(1,col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(locate(1,col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 char(5))
+partition by range(octet_length(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 char(5))
+partition by range(position(1 in col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(position(1 in col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 char(5))
+partition by range(strcmp(col1,2))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(strcmp(col1,2))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(crc32(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(round(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(sign(col1))
+(partition p0 values less than (2), partition p1 values less than (6));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 datetime)
+partition by range(period_add(col1,5))
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 datetime, col2 datetime)
+partition by range(period_diff(col1,col2))
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int, col2 int)
+partition by range(period_diff(col1,col2))
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 datetime)
+partition by range(timestampdiff(day,5,col1))
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 date)
+partition by range(unix_timestamp(col1))
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 datetime)
+partition by range(week(col1))
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 varchar(25))
+partition by range(cast(col1 as signed))
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 varchar(25))
+partition by range(convert(col1,unsigned))
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(col1 | 20)
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(col1 & 20)
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(col1 ^ 20)
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(col1 << 20)
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(col1 >> 20)
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(~col1)
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(bit_count(col1))
+(partition p0 values less than (10), partition p1 values less than (30));
+
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (col1 int)
+partition by range(inet_aton(col1))
+(partition p0 values less than (10), partition p1 values less than (30));
diff --git a/mysql-test/t/partition_charset.test b/mysql-test/t/partition_charset.test
index 27d0dc87b89..5e8f128e87a 100644
--- a/mysql-test/t/partition_charset.test
+++ b/mysql-test/t/partition_charset.test
@@ -19,3 +19,10 @@ flush tables;
set names latin1;
select * from t1;
drop table t1;
+
+create table t1 (a varchar(1), primary key (a))
+partition by list (ascii(a))
+(partition p1 values in (65));
+insert into t1 values ('A');
+replace into t1 values ('A');
+drop table t1;
diff --git a/mysql-test/t/partition_list.test b/mysql-test/t/partition_list.test
index 1e420cfe6ed..7d71d66f2d9 100644
--- a/mysql-test/t/partition_list.test
+++ b/mysql-test/t/partition_list.test
@@ -179,4 +179,8 @@ insert into t1 values (null);
select * from t1;
drop table t1;
+-- error ER_PARTITION_FUNC_NOT_ALLOWED
+create table t1 (a char(1))
+partition by list (ascii(ucase(a)))
+(partition p1 values in (2));