From: Sergey Petrunia Date: October 14 2008 2:08am Subject: bzr commit into mysql-6.0-opt-subqueries branch (sergefp:2699) List-Archive: http://lists.mysql.com/commits/56195 Message-Id: <20081014020813.2CDE415A310@pslp2.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT #At file:///home/spetrunia/dev/mysql-6.0-subq-r16-review-feedback/ 2699 Sergey Petrunia 2008-10-14 Fix the problem introduced in the previous cset: don't buypass subquery rewrite for non-IN subqueries. modified: sql/sql_select.cc per-file messages: sql/sql_select.cc Fix the problem introduced in the previous cset: don't buypass subquery rewrite for non-IN subqueries. === modified file 'sql/sql_select.cc' --- a/sql/sql_select.cc 2008-10-13 22:27:26 +0000 +++ b/sql/sql_select.cc 2008-10-14 02:07:59 +0000 @@ -564,13 +564,14 @@ JOIN::prepare(Item ***rref_pointer_array TODO: for PS, make the whole block execute only on the first execution */ Item_subselect *subselect; - if (!thd->lex->view_prepare_mode && - (subselect= select_lex->master_unit()->item) && - subselect->substype() == Item_subselect::IN_SUBS) + if (!thd->lex->view_prepare_mode && + (subselect= select_lex->master_unit()->item)) { - Item_in_subselect *in_subs= (Item_in_subselect*)subselect; + Item_in_subselect *in_subs= NULL; bool do_semijoin= !test(thd->variables.optimizer_switch & OPTIMIZER_SWITCH_NO_SEMIJOIN); + if (subselect->substype() == Item_subselect::IN_SUBS) + in_subs= (Item_in_subselect*)subselect; DBUG_PRINT("info", ("Checking if subq can be converted to semi-join")); /* Check if we're in subquery that is a candidate for flattening into a