summaryrefslogtreecommitdiff
path: root/mysql-test/t/ps.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-01-23 19:40:22 -0800
committerIgor Babaev <igor@askmonty.org>2017-01-23 19:40:22 -0800
commit46eef1ede2ddfceaa056a71ea52ecacdde2bc44e (patch)
treedb8ce35b02961d9efc0b7428273ac28670b18ccc /mysql-test/t/ps.test
parentf003cc8a35a4cdd9621621f95da889777b8b31b0 (diff)
downloadmariadb-git-46eef1ede2ddfceaa056a71ea52ecacdde2bc44e.tar.gz
Fixed bug mdev-11859.
As the function Item_subselect::fix_fields does it the function Item_subselect::update_used_tables must ignore UNCACHEABLE_EXPLAIN when deciding whether the subquery item should be considered as a constant item.
Diffstat (limited to 'mysql-test/t/ps.test')
-rw-r--r--mysql-test/t/ps.test33
1 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 1516acca01e..cfd810fd625 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3680,5 +3680,38 @@ EXECUTE stmt;
deallocate prepare stmt;
drop table t1,t2,t3,t4;
+--echo #
+--echo # MDEV-11859: the plans for the first and the second executions
+--echo # of PS are not the same
+--echo #
+
+create table t1 (id int, c varchar(3), key idx(c))engine=myisam;
+insert into t1 values (3,'bar'), (1,'xxx'), (2,'foo'), (5,'yyy');
+
+prepare stmt1 from
+"explain extended
+ select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+prepare stmt1 from
+"select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
+flush status;
+execute stmt1;
+show status like '%Handler_read%';
+flush status;
+execute stmt1;
+show status like '%Handler_read%';
+deallocate prepare stmt1;
+
+prepare stmt2 from
+"explain extended
+ select * from t1 where (1, 2) in ( select 3, 4 )";
+execute stmt2;
+execute stmt2;
+deallocate prepare stmt2;
+
+drop table t1;
--echo # End of 5.5 tests