From 409902f8843c49be3c9e81f49b59fad6298b874a Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Tue, 5 Apr 2011 11:16:28 +0400 Subject: [PATCH] MWL#90: address review feedback: more test coverage - Forgot to add .result file --- mysql-test/r/subselect_mat.result | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result index 816d33cae09..c298f1b366d 100644 --- a/mysql-test/r/subselect_mat.result +++ b/mysql-test/r/subselect_mat.result @@ -1286,6 +1286,38 @@ a a in (select a from t1) 2 0 drop table t0, t1; set optimizer_switch='firstmatch=on'; +# +# MWL#90, review feedback: check what happens when the subquery +# looks like candidate for MWL#90 checking at the first glance +# but then subselect_hash_sj_engine::init_permanent() discovers +# that it's not possible to perform duplicate removal for the +# selected datatypes, and so materialization isn't applicable after +# all. +# +set @blob_len = 1024; +set @suffix_len = @blob_len - @prefix_len; +create table t1_1024 (a1 blob(1024), a2 blob(1024)); +create table t2_1024 (b1 blob(1024), b2 blob(1024)); +insert into t1_1024 values +(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len))); +insert into t1_1024 values +(concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len))); +insert into t1_1024 values +(concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len))); +insert into t2_1024 values +(concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len))); +insert into t2_1024 values +(concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len))); +insert into t2_1024 values +(concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len))); +explain select left(a1,7), left(a2,7) from t1_1024 where (a1,3) in (select substring(b1,1,1024), count(*) from t2_1024 where b1 > '0'); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 Using where +select left(a1,7), left(a2,7) from t1_1024 where (a1,3) in (select substring(b1,1,1024), count(*) from t2_1024 where b1 > '0'); +left(a1,7) left(a2,7) +1 - 01x 2 - 01x +drop table t1_1024, t2_1024; set @@optimizer_switch=default; create table t0 (a int); insert into t0 values (0),(1),(2);