summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <mikron@mikael-ronstr-ms-dator.local>2007-04-12 20:34:36 +0200
committerunknown <mikron@mikael-ronstr-ms-dator.local>2007-04-12 20:34:36 +0200
commit2ad7512a57f5a6e33d7d0f56d8067ef45df23b94 (patch)
tree8d6b90a9aafba2369000222559931af1fb016b31 /mysql-test/t
parent8e6769b0408691ecdb1fd2be7031c4c6ba365ae9 (diff)
downloadmariadb-git-2ad7512a57f5a6e33d7d0f56d8067ef45df23b94.tar.gz
More test cases
mysql-test/t/partition_charset.test: New test case from bug report mysql-test/t/partition_list.test: New test case from bug report mysql-test/r/partition_bug18198.result: New test case mysql-test/t/partition_bug18198.test: New test case
Diffstat (limited to 'mysql-test/t')
-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
3 files changed, 263 insertions, 0 deletions
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));