summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <mikael/pappa@dator5.(none)>2006-08-02 07:01:38 -0400
committerunknown <mikael/pappa@dator5.(none)>2006-08-02 07:01:38 -0400
commit66f51d15742da645513e6f50db28d5a47e97fc5f (patch)
treef18a764bff80f479eb18d1517215d1160a408a07 /mysql-test/t
parent95dcd768ca9da1f50f0ddfc42c9072c0001bc3d5 (diff)
parentbcd98d512db7957896e44059e1f291c04aca3550 (diff)
downloadmariadb-git-66f51d15742da645513e6f50db28d5a47e97fc5f.tar.gz
Merge dator5.(none):/home/pappa/clean-mysql-5.1
into dator5.(none):/home/pappa/bug18198 mysql-test/r/partition_pruning.result: Auto merged mysql-test/t/partition_pruning.test: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_func.h: Auto merged sql/sql_partition.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/item_strfunc.h: SCCS merged
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/partition.test12
-rw-r--r--mysql-test/t/partition_error.test24
-rw-r--r--mysql-test/t/partition_pruning.test18
-rw-r--r--mysql-test/t/partition_range.test30
4 files changed, 71 insertions, 13 deletions
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index d4e930f91ec..6fe06dfc8af 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -883,11 +883,13 @@ drop table t2;
#
# 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;
+# utf columns not supported after Bug #18198 is fixed
+#
+#create table t1 (s1 char(2) character set utf8)
+#partition by list (cast(s1 as signed))
+#(partition p1 values in (1),
+# partition p2 values in (2));
+#drop table t1;
#
# Bug#15336 Partitions: crash if create table as select
diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test
index d0e3f355292..2c0706cb2cb 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)
@@ -787,10 +809,10 @@ partition by range (a)
#
# Bug 18198 Partitions: Verify that erroneus partition functions doesn't work
#
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
create table t1 (v varchar(12))
partition by range (ascii(v))
(partition p0 values less than (10));
-drop table t1;
-- error 1064
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 670b9333ab9..8cf2313e39c 100644
--- a/mysql-test/t/partition_range.test
+++ b/mysql-test/t/partition_range.test
@@ -686,3 +686,33 @@ EXPLAIN PARTITIONS SELECT * from t1
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;