summaryrefslogtreecommitdiff
path: root/mysql-test/suite/versioning
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2018-12-26 13:24:45 +0300
committerAleksey Midenkov <midenok@gmail.com>2019-08-11 12:32:08 +0300
commitcdbac54df0bd857a053decd66b6067abf15a6801 (patch)
tree0e23f602802e63e884c807c9eabed91cdb4851a3 /mysql-test/suite/versioning
parent43882e764d6867c6855b1ff057758a3f08b25c55 (diff)
downloadmariadb-git-cdbac54df0bd857a053decd66b6067abf15a6801.tar.gz
MDEV-17613 MIN/MAX Optimization (Select tables optimized away) does not work
Prune to now-partition when there is no FOR SYSTEM_TIME clause.
Diffstat (limited to 'mysql-test/suite/versioning')
-rw-r--r--mysql-test/suite/versioning/r/partition.result11
-rw-r--r--mysql-test/suite/versioning/r/partition_rotation.result2
-rw-r--r--mysql-test/suite/versioning/t/partition.test21
3 files changed, 33 insertions, 1 deletions
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index c0a163ed027..588e6432c4a 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -546,6 +546,17 @@ t1 CREATE TABLE `t1` (
#
create or replace table t1 (f int) with system versioning partition by hash(f);
insert delayed into t1 values (1);
+#
+# MDEV-17613 MIN/MAX Optimization (Select tables optimized away) does not work
+#
+create or replace table t1 (pk int primary key) with system versioning
+partition by system_time (
+partition p1 history,
+partition pn current);
+insert into t1 values (1), (2);
+explain select max(pk) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
# Test cleanup
drop database test;
create database test;
diff --git a/mysql-test/suite/versioning/r/partition_rotation.result b/mysql-test/suite/versioning/r/partition_rotation.result
index 7e25f122238..69b30a56bd6 100644
--- a/mysql-test/suite/versioning/r/partition_rotation.result
+++ b/mysql-test/suite/versioning/r/partition_rotation.result
@@ -44,7 +44,7 @@ i
6
explain partitions select * from t1;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 2 Using where
+1 SIMPLE t1 pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 2
explain partitions select * from t1 for system_time as of '2001-02-04 10:20:30';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1_p1sp0,p1_p1sp1,p0_p0sp0,p0_p0sp1,p2_p2sp0,p2_p2sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL # Using where
diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test
index cd16ab7c466..29e4c413f77 100644
--- a/mysql-test/suite/versioning/t/partition.test
+++ b/mysql-test/suite/versioning/t/partition.test
@@ -497,6 +497,27 @@ create or replace table t1 (f int) with system versioning partition by hash(f);
--error 0,ER_DELAYED_NOT_SUPPORTED
insert delayed into t1 values (1);
+--echo #
+--echo # MDEV-17613 MIN/MAX Optimization (Select tables optimized away) does not work
+--echo #
+--disable_query_log
+set @saved_storage_engine= @@default_storage_engine;
+if ($MTR_COMBINATION_HEAP)
+{
+ # This case does not work with HEAP
+ set default_storage_engine= myisam;
+}
+--enable_query_log
+create or replace table t1 (pk int primary key) with system versioning
+partition by system_time (
+ partition p1 history,
+ partition pn current);
+insert into t1 values (1), (2);
+explain select max(pk) from t1;
+--disable_query_log
+set default_storage_engine= @saved_storage_engine;
+--enable_query_log
+
--echo # Test cleanup
drop database test;
create database test;