summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorholyfoot/hf@deer.(none) <>2006-10-18 11:17:38 +0500
committerholyfoot/hf@deer.(none) <>2006-10-18 11:17:38 +0500
commit9aa346bb26c76914889ec8b3ee3cea99f1f76925 (patch)
tree9919eb842cd89952a8a4ce1200232f008b67e338 /mysql-test/t
parent76bc3e2eb57f2938c2a75142231d153c1fb0bc04 (diff)
parent4a7cd3a1cb103854af8b38a47a966d2b06d68045 (diff)
downloadmariadb-git-9aa346bb26c76914889ec8b3ee3cea99f1f76925.tar.gz
Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-5.1-kt
into mysql.com:/home/hf/mysql-5.1.mrg
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/partition-master.opt1
-rw-r--r--mysql-test/t/partition.test46
-rw-r--r--mysql-test/t/partition_error.test18
-rw-r--r--mysql-test/t/partition_hash.test12
-rw-r--r--mysql-test/t/partition_innodb.test68
-rw-r--r--mysql-test/t/partition_pruning.test18
-rw-r--r--mysql-test/t/partition_range.test78
7 files changed, 161 insertions, 80 deletions
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;