From 46eef1ede2ddfceaa056a71ea52ecacdde2bc44e Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Mon, 23 Jan 2017 19:40:22 -0800 Subject: 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. --- mysql-test/t/ps.test | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'mysql-test/t/ps.test') 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 -- cgit v1.2.1