summaryrefslogtreecommitdiff
path: root/mysql-test/t/partition_range.test
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@mysql.com>2009-09-15 17:07:52 +0200
committerMikael Ronstrom <mikael@mysql.com>2009-09-15 17:07:52 +0200
commit6942c25e733967e4d3da8aaad3b2e9a2832dc33e (patch)
treeee714c9620c9eaa85fba98f4423487d638cc9edf /mysql-test/t/partition_range.test
parent905d715f10e711860311e0a10488c6bb5e19ee49 (diff)
downloadmariadb-git-6942c25e733967e4d3da8aaad3b2e9a2832dc33e.tar.gz
WL#3352, Introducing Column list partitioning, makes it possible to partition on most data types, makes it possible to prune on multi-field partitioning
Diffstat (limited to 'mysql-test/t/partition_range.test')
-rw-r--r--mysql-test/t/partition_range.test76
1 files changed, 76 insertions, 0 deletions
diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test
index c02d9049f2e..c14dfd1822d 100644
--- a/mysql-test/t/partition_range.test
+++ b/mysql-test/t/partition_range.test
@@ -9,6 +9,82 @@
drop table if exists t1, t2;
--enable_warnings
+--error ER_PARSE_ERROR
+create table t1 (a int)
+partition by range (a)
+( partition p0 values less than (NULL),
+ partition p1 values less than (MAXVALUE));
+#
+# Merge fix of bug#27927 for TO_SECONDS function
+#
+create table t1 (a datetime not null)
+partition by range (TO_SECONDS(a))
+( partition p0 VALUES LESS THAN (TO_SECONDS('2007-03-08 00:00:00')),
+ partition p1 VALUES LESS THAN (TO_SECONDS('2007-04-01 00:00:00')));
+INSERT INTO t1 VALUES ('2007-03-01 12:00:00'), ('2007-03-07 12:00:00');
+INSERT INTO t1 VALUES ('2007-03-08 12:00:00'), ('2007-03-15 12:00:00');
+explain partitions select * from t1 where a < '2007-03-08 00:00:00';
+explain partitions select * from t1 where a < '2007-03-08 00:00:01';
+explain partitions select * from t1 where a <= '2007-03-08 00:00:00';
+explain partitions select * from t1 where a <= '2007-03-07 23:59:59';
+explain partitions select * from t1 where a < '2007-03-07 23:59:59';
+drop table t1;
+#
+# New test cases for new function to_seconds
+#
+create table t1 (a date)
+partition by range(to_seconds(a))
+(partition p0 values less than (to_seconds('2004-01-01')),
+ partition p1 values less than (to_seconds('2005-01-01')));
+insert into t1 values ('2003-12-30'),('2004-12-31');
+select * from t1;
+explain partitions select * from t1 where a <= '2003-12-31';
+select * from t1 where a <= '2003-12-31';
+explain partitions select * from t1 where a <= '2005-01-01';
+select * from t1 where a <= '2005-01-01';
+drop table t1;
+
+create table t1 (a datetime)
+partition by range(to_seconds(a))
+(partition p0 values less than (to_seconds('2004-01-01 12:00:00')),
+ partition p1 values less than (to_seconds('2005-01-01 12:00:00')));
+insert into t1 values ('2004-01-01 11:59:29'),('2005-01-01 11:59:59');
+select * from t1;
+explain partitions select * from t1 where a <= '2004-01-01 11:59.59';
+select * from t1 where a <= '2004-01-01 11:59:59';
+explain partitions select * from t1 where a <= '2005-01-01';
+select * from t1 where a <= '2005-01-01';
+drop table t1;
+
+#
+# Adding new test cases for column list variant for partitioning
+#
+--error 1064
+create table t1 (a int, b char(20))
+partition by range column_list(a,b)
+(partition p0 values less than (1));
+
+--error ER_PARTITION_COLUMN_LIST_ERROR
+create table t1 (a int, b char(20))
+partition by range(a)
+(partition p0 values less than (column_list(1,"b")));
+
+--error ER_PARTITION_COLUMN_LIST_ERROR
+create table t1 (a int, b char(20))
+partition by range(a)
+(partition p0 values less than (column_list(1,"b")));
+
+create table t1 (a int, b char(20));
+create global index inx on t1 (a,b)
+partition by range (a)
+(partition p0 values less than (1));
+drop table t1;
+
+create table t1 (a int, b char(20))
+partition by range column_list(b)
+(partition p0 values less than (column_list("b")));
+drop table t1;
+
#
# BUG 33429: Succeeds in adding partition when maxvalue on last partition
#