summaryrefslogtreecommitdiff
path: root/mysql-test/r/subselect_no_scache.result
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2012-10-12 16:44:54 +0300
committerunknown <timour@askmonty.org>2012-10-12 16:44:54 +0300
commite47cdfdfb6b2b6512b13fa097ee092638e05266a (patch)
tree3f198bde2ac3d52c2a113f714922bbbd6ef1e558 /mysql-test/r/subselect_no_scache.result
parentfc941f8a2143ce7670f49c2638f352c16f4b9ddb (diff)
downloadmariadb-git-e47cdfdfb6b2b6512b13fa097ee092638e05266a.tar.gz
MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields
Fix by Sergey Petrunia. This patch only prevents the evaluation of expensive subqueries during optimization. The crash reported in this bug has been fixed by some other patch. The fix is to call value->is_null() only when !value->is_expensive(), because is_null() may trigger evaluation of the Item, which in turn triggers subquery evaluation if the Item is a subquery.
Diffstat (limited to 'mysql-test/r/subselect_no_scache.result')
-rw-r--r--mysql-test/r/subselect_no_scache.result21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index e68f5990c08..f648385f67a 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -6853,6 +6853,27 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2;
#
+# MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields
+#
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (8),(0);
+CREATE TABLE t2 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (4,'j'),(6,'v');
+CREATE TABLE t3 (d VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES ('b'),('c');
+EXPLAIN
+SELECT * FROM t1
+WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
+2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
+SELECT * FROM t1
+WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
+a
+drop table t1, t2, t3;
+#
# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
#
CREATE TABLE t1 (a INT, KEY(a));