summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@oracle.com>2010-10-15 09:27:28 +0200
committerMattias Jonsson <mattias.jonsson@oracle.com>2010-10-15 09:27:28 +0200
commit2234783085de0865192c5a30af89cb20643c6322 (patch)
treef4cf68033c8b89a8a60fbbabd57d835f0c807ca7 /mysql-test
parentb001a5224d8b26e9706a386ca2c26320d152ee1c (diff)
parent428f0bdefbf866f0a9939e4153393b1e4b8a1a82 (diff)
downloadmariadb-git-2234783085de0865192c5a30af89cb20643c6322.tar.gz
merge
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/partition_innodb.result26
-rw-r--r--mysql-test/t/partition_innodb.test24
2 files changed, 50 insertions, 0 deletions
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 238fbf4662c..af4a03bb0ea 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -1,5 +1,31 @@
drop table if exists t1, t2;
#
+# Bug#56287: crash when using Partition datetime in sub in query
+#
+CREATE TABLE t1
+(c1 bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+c2 varchar(40) not null default '',
+c3 datetime not NULL,
+PRIMARY KEY (c1,c3),
+KEY partidx(c3))
+ENGINE=InnoDB
+PARTITION BY RANGE (TO_DAYS(c3))
+(PARTITION p200912 VALUES LESS THAN (to_days('2010-01-01')),
+PARTITION p201103 VALUES LESS THAN (to_days('2011-04-01')),
+PARTITION p201912 VALUES LESS THAN MAXVALUE);
+insert into t1(c2,c3) values ("Test row",'2010-01-01 00:00:00');
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+PARTITION_NAME TABLE_ROWS
+p200912 0
+p201103 1
+p201912 0
+SELECT count(*) FROM t1 p where c3 in
+(select c3 from t1 t where t.c3 < date '2011-04-26 19:19:44'
+ and t.c3 > date '2011-04-26 19:18:44') ;
+count(*)
+0
+DROP TABLE t1;
+#
# Bug#51830: Incorrect partition pruning on range partition (regression)
#
CREATE TABLE t1 (a INT NOT NULL)
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index e1ac7b4c7eb..ca668d77199 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -8,6 +8,30 @@ drop table if exists t1, t2;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
+--echo # Bug#56287: crash when using Partition datetime in sub in query
+--echo #
+CREATE TABLE t1
+(c1 bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ c2 varchar(40) not null default '',
+ c3 datetime not NULL,
+ PRIMARY KEY (c1,c3),
+ KEY partidx(c3))
+ENGINE=InnoDB
+PARTITION BY RANGE (TO_DAYS(c3))
+(PARTITION p200912 VALUES LESS THAN (to_days('2010-01-01')),
+ PARTITION p201103 VALUES LESS THAN (to_days('2011-04-01')),
+ PARTITION p201912 VALUES LESS THAN MAXVALUE);
+
+insert into t1(c2,c3) values ("Test row",'2010-01-01 00:00:00');
+
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+SELECT count(*) FROM t1 p where c3 in
+(select c3 from t1 t where t.c3 < date '2011-04-26 19:19:44'
+ and t.c3 > date '2011-04-26 19:18:44') ;
+
+DROP TABLE t1;
+
+--echo #
--echo # Bug#51830: Incorrect partition pruning on range partition (regression)
--echo #
CREATE TABLE t1 (a INT NOT NULL)