Loading mysql-test/r/subselect.result +75 −1 Original line number Diff line number Diff line Loading @@ -269,7 +269,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 Warnings: Note 1003 select test.t3.a AS `a` from test.t3 where (test.t3.a >= (select min(test.t2.b) from test.t2)) Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= (select min(test.t2.b) from test.t2))) select * from t3 where a >= all (select b from t2); a 7 Loading Loading @@ -1488,6 +1488,71 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a < (select max(test.t2.b) from test.t2))) select * from t3 where a >= some (select b from t2); a 6 7 3 explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= (select min(test.t2.b) from test.t2))) select * from t3 where a >= all (select b from t2 group by 1); a 6 7 3 explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a < <max>(select test.t2.b AS `b` from test.t2 group by test.t2.b))) select * from t3 where a >= some (select b from t2 group by 1); a 6 7 3 explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= <min>(select test.t2.b AS `b` from test.t2 group by test.t2.b))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 select * from t3 where NULL >= any (select b from t2 group by 1); a explain extended select * from t3 where NULL >= any (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 select * from t3 where NULL >= some (select b from t2); a explain extended select * from t3 where NULL >= some (select b from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 select * from t3 where NULL >= some (select b from t2 group by 1); a explain extended select * from t3 where NULL >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 insert into t2 values (2,2), (2,1), (3,3), (3,1); select * from t3 where a > all (select max(b) from t2 group by a); a Loading Loading @@ -2031,3 +2096,12 @@ insert into t1 values (20,15); select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0)); s1 s2 drop table t1; create table t1 (s1 int); insert into t1 values (1),(null); select * from t1 where s1 < all (select s1 from t1); s1 select s1, s1 < all (select s1 from t1) from t1; s1 s1 < all (select s1 from t1) 1 0 NULL NULL drop table t1; mysql-test/t/subselect.test +23 −1 Original line number Diff line number Diff line Loading @@ -911,7 +911,20 @@ create table t3 (a int); insert into t3 values (6),(7),(3); select * from t3 where a >= all (select b from t2); explain extended select * from t3 where a >= all (select b from t2); select * from t3 where a >= some (select b from t2); explain extended select * from t3 where a >= some (select b from t2); select * from t3 where a >= all (select b from t2 group by 1); explain extended select * from t3 where a >= all (select b from t2 group by 1); select * from t3 where a >= some (select b from t2 group by 1); explain extended select * from t3 where a >= some (select b from t2 group by 1); select * from t3 where NULL >= any (select b from t2); explain extended select * from t3 where NULL >= any (select b from t2); select * from t3 where NULL >= any (select b from t2 group by 1); explain extended select * from t3 where NULL >= any (select b from t2 group by 1); select * from t3 where NULL >= some (select b from t2); explain extended select * from t3 where NULL >= some (select b from t2); select * from t3 where NULL >= some (select b from t2 group by 1); explain extended select * from t3 where NULL >= some (select b from t2 group by 1); # # optimized static ALL/ANY with grouping # Loading Loading @@ -1336,3 +1349,12 @@ create table t1 (s1 int,s2 int); insert into t1 values (20,15); select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0)); drop table t1; # # ALL/ANY with NULL # create table t1 (s1 int); insert into t1 values (1),(null); select * from t1 where s1 < all (select s1 from t1); select s1, s1 < all (select s1 from t1) from t1; drop table t1; sql/item_cmpfunc.cc +39 −7 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ longlong Item_func_not::val_int() DBUG_ASSERT(fixed == 1); double value=args[0]->val(); null_value=args[0]->null_value; return !null_value && value == 0 ? 1 : 0; return ((!null_value && value == 0) ? 1 : 0); } /* Loading @@ -117,13 +117,23 @@ longlong Item_func_not_all::val_int() { DBUG_ASSERT(fixed == 1); double value= args[0]->val(); if (abort_on_null) { null_value= 0; return (args[0]->null_value || value == 0) ? 1 : 0; } /* return TRUE if there was records in underlaying select in max/min optimisation */ if (empty_underlying_subquery()) return 1; null_value= args[0]->null_value; return (!null_value && value == 0) ? 1 : 0; return ((!null_value && value == 0) ? 1 : 0); } bool Item_func_not_all::empty_underlying_subquery() { return ((test_sum_item && !test_sum_item->any_value()) || (test_sub_item && !test_sub_item->any_value())); } void Item_func_not_all::print(String *str) Loading @@ -134,6 +144,28 @@ void Item_func_not_all::print(String *str) args[0]->print(str); } /* special NOP for ALL subquery */ longlong Item_func_nop_all::val_int() { DBUG_ASSERT(fixed == 1); double value= args[0]->val(); /* return TRUE if there was records in underlaying select in max/min optimisation */ if (empty_underlying_subquery()) return 1; null_value= args[0]->null_value; return (null_value || value == 0) ? 0 : 1; } /* Convert a constant expression or string to an integer. This is done when comparing DATE's of different formats and Loading sql/item_cmpfunc.h +23 −1 Original line number Diff line number Diff line Loading @@ -229,21 +229,43 @@ class Item_func_not :public Item_bool_func Item *neg_transformer(THD *thd); }; class Item_maxmin_subselect; class Item_func_not_all :public Item_func_not { /* allow to check presence od values in max/min optimisation */ Item_sum_hybrid *test_sum_item; Item_maxmin_subselect *test_sub_item; bool abort_on_null; public: bool show; Item_func_not_all(Item *a) :Item_func_not(a), abort_on_null(0), show(0) {} Item_func_not_all(Item *a) :Item_func_not(a), test_sum_item(0), test_sub_item(0), abort_on_null(0), show(0) {} virtual void top_level_item() { abort_on_null= 1; } bool top_level() { return abort_on_null; } longlong val_int(); enum Functype functype() const { return NOT_ALL_FUNC; } const char *func_name() const { return "<not>"; } void print(String *str); void set_sum_test(Item_sum_hybrid *item) { test_sum_item= item; }; void set_sub_test(Item_maxmin_subselect *item) { test_sub_item= item; }; bool empty_underlying_subquery(); }; class Item_func_nop_all :public Item_func_not_all { public: Item_func_nop_all(Item *a) :Item_func_not_all(a) {} longlong val_int(); const char *func_name() const { return "<nop>"; } }; class Item_func_eq :public Item_bool_rowready_func2 { public: Loading sql/item_subselect.cc +28 −7 Original line number Diff line number Diff line Loading @@ -271,7 +271,7 @@ Item_singlerow_subselect::Item_singlerow_subselect(st_select_lex *select_lex) Item_maxmin_subselect::Item_maxmin_subselect(Item_subselect *parent, st_select_lex *select_lex, bool max_arg) :Item_singlerow_subselect() :Item_singlerow_subselect(), was_values(TRUE) { DBUG_ENTER("Item_maxmin_subselect::Item_maxmin_subselect"); max= max_arg; Loading @@ -290,12 +290,26 @@ Item_maxmin_subselect::Item_maxmin_subselect(Item_subselect *parent, DBUG_VOID_RETURN; } void Item_maxmin_subselect::cleanup() { /* By default is is TRUE to avoid TRUE reporting by Item_func_not_all/Item_func_nop_all if this item was never called. Engine exec() set it to FALSE by reset_value_registration() call. */ was_values= TRUE; } void Item_maxmin_subselect::print(String *str) { str->append(max?"<max>":"<min>", 5); Item_singlerow_subselect::print(str); } void Item_singlerow_subselect::reset() { null_value= 1; Loading @@ -303,6 +317,7 @@ void Item_singlerow_subselect::reset() value->null_value= 1; } Item_subselect::trans_res Item_singlerow_subselect::select_transformer(JOIN *join) { Loading Loading @@ -519,7 +534,7 @@ bool Item_in_subselect::test_limit(SELECT_LEX_UNIT *unit) Item_in_subselect::Item_in_subselect(Item * left_exp, st_select_lex *select_lex): Item_exists_subselect(), transformed(0), upper_not(0) Item_exists_subselect(), transformed(0), upper_item(0) { DBUG_ENTER("Item_in_subselect::Item_in_subselect"); left_expr= left_exp; Loading Loading @@ -680,7 +695,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, NULL/IS NOT NULL functions). If so, we rewrite ALL/ANY with NOT EXISTS later in this method. */ if ((abort_on_null || (upper_not && upper_not->top_level())) && if ((abort_on_null || (upper_item && upper_item->top_level())) && !select_lex->master_unit()->uncacheable && !func->eqne_op()) { if (substitution) Loading @@ -694,7 +709,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, !select_lex->with_sum_func && !(select_lex->next_select())) { Item *item; Item_sum_hybrid *item; if (func->l_op()) { /* Loading @@ -711,6 +726,8 @@ Item_in_subselect::single_value_transformer(JOIN *join, */ item= new Item_sum_min(*select_lex->ref_pointer_array); } if (upper_item) upper_item->set_sum_test(item); *select_lex->ref_pointer_array= item; { List_iterator<Item> it(select_lex->item_list); Loading @@ -731,10 +748,13 @@ Item_in_subselect::single_value_transformer(JOIN *join, } else { Item_maxmin_subselect *item; // remove LIMIT placed by ALL/ANY subquery select_lex->master_unit()->global_parameters->select_limit= HA_POS_ERROR; subs= new Item_maxmin_subselect(this, select_lex, func->l_op()); subs= item= new Item_maxmin_subselect(this, select_lex, func->l_op()); if (upper_item) upper_item->set_sub_test(item); } // left expression belong to outer select SELECT_LEX *current= thd->lex->current_select, *up; Loading Loading @@ -1041,8 +1061,8 @@ Item_subselect::trans_res Item_allany_subselect::select_transformer(JOIN *join) { transformed= 1; if (upper_not) upper_not->show= 1; if (upper_item) upper_item->show= 1; return single_value_transformer(join, func); } Loading Loading @@ -1247,6 +1267,7 @@ int subselect_single_select_engine::exec() } if (!executed) { item->reset_value_registration(); join->exec(); executed= 1; join->thd->where= save_where; Loading Loading
mysql-test/r/subselect.result +75 −1 Original line number Diff line number Diff line Loading @@ -269,7 +269,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 Warnings: Note 1003 select test.t3.a AS `a` from test.t3 where (test.t3.a >= (select min(test.t2.b) from test.t2)) Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= (select min(test.t2.b) from test.t2))) select * from t3 where a >= all (select b from t2); a 7 Loading Loading @@ -1488,6 +1488,71 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a < (select max(test.t2.b) from test.t2))) select * from t3 where a >= some (select b from t2); a 6 7 3 explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= (select min(test.t2.b) from test.t2))) select * from t3 where a >= all (select b from t2 group by 1); a 6 7 3 explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a < <max>(select test.t2.b AS `b` from test.t2 group by test.t2.b))) select * from t3 where a >= some (select b from t2 group by 1); a 6 7 3 explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= <min>(select test.t2.b AS `b` from test.t2 group by test.t2.b))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 select * from t3 where NULL >= any (select b from t2 group by 1); a explain extended select * from t3 where NULL >= any (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 select * from t3 where NULL >= some (select b from t2); a explain extended select * from t3 where NULL >= some (select b from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 select * from t3 where NULL >= some (select b from t2 group by 1); a explain extended select * from t3 where NULL >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found Warnings: Note 1003 select test.t3.a AS `a` from test.t3 insert into t2 values (2,2), (2,1), (3,3), (3,1); select * from t3 where a > all (select max(b) from t2 group by a); a Loading Loading @@ -2031,3 +2096,12 @@ insert into t1 values (20,15); select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0)); s1 s2 drop table t1; create table t1 (s1 int); insert into t1 values (1),(null); select * from t1 where s1 < all (select s1 from t1); s1 select s1, s1 < all (select s1 from t1) from t1; s1 s1 < all (select s1 from t1) 1 0 NULL NULL drop table t1;
mysql-test/t/subselect.test +23 −1 Original line number Diff line number Diff line Loading @@ -911,7 +911,20 @@ create table t3 (a int); insert into t3 values (6),(7),(3); select * from t3 where a >= all (select b from t2); explain extended select * from t3 where a >= all (select b from t2); select * from t3 where a >= some (select b from t2); explain extended select * from t3 where a >= some (select b from t2); select * from t3 where a >= all (select b from t2 group by 1); explain extended select * from t3 where a >= all (select b from t2 group by 1); select * from t3 where a >= some (select b from t2 group by 1); explain extended select * from t3 where a >= some (select b from t2 group by 1); select * from t3 where NULL >= any (select b from t2); explain extended select * from t3 where NULL >= any (select b from t2); select * from t3 where NULL >= any (select b from t2 group by 1); explain extended select * from t3 where NULL >= any (select b from t2 group by 1); select * from t3 where NULL >= some (select b from t2); explain extended select * from t3 where NULL >= some (select b from t2); select * from t3 where NULL >= some (select b from t2 group by 1); explain extended select * from t3 where NULL >= some (select b from t2 group by 1); # # optimized static ALL/ANY with grouping # Loading Loading @@ -1336,3 +1349,12 @@ create table t1 (s1 int,s2 int); insert into t1 values (20,15); select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0)); drop table t1; # # ALL/ANY with NULL # create table t1 (s1 int); insert into t1 values (1),(null); select * from t1 where s1 < all (select s1 from t1); select s1, s1 < all (select s1 from t1) from t1; drop table t1;
sql/item_cmpfunc.cc +39 −7 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ longlong Item_func_not::val_int() DBUG_ASSERT(fixed == 1); double value=args[0]->val(); null_value=args[0]->null_value; return !null_value && value == 0 ? 1 : 0; return ((!null_value && value == 0) ? 1 : 0); } /* Loading @@ -117,13 +117,23 @@ longlong Item_func_not_all::val_int() { DBUG_ASSERT(fixed == 1); double value= args[0]->val(); if (abort_on_null) { null_value= 0; return (args[0]->null_value || value == 0) ? 1 : 0; } /* return TRUE if there was records in underlaying select in max/min optimisation */ if (empty_underlying_subquery()) return 1; null_value= args[0]->null_value; return (!null_value && value == 0) ? 1 : 0; return ((!null_value && value == 0) ? 1 : 0); } bool Item_func_not_all::empty_underlying_subquery() { return ((test_sum_item && !test_sum_item->any_value()) || (test_sub_item && !test_sub_item->any_value())); } void Item_func_not_all::print(String *str) Loading @@ -134,6 +144,28 @@ void Item_func_not_all::print(String *str) args[0]->print(str); } /* special NOP for ALL subquery */ longlong Item_func_nop_all::val_int() { DBUG_ASSERT(fixed == 1); double value= args[0]->val(); /* return TRUE if there was records in underlaying select in max/min optimisation */ if (empty_underlying_subquery()) return 1; null_value= args[0]->null_value; return (null_value || value == 0) ? 0 : 1; } /* Convert a constant expression or string to an integer. This is done when comparing DATE's of different formats and Loading
sql/item_cmpfunc.h +23 −1 Original line number Diff line number Diff line Loading @@ -229,21 +229,43 @@ class Item_func_not :public Item_bool_func Item *neg_transformer(THD *thd); }; class Item_maxmin_subselect; class Item_func_not_all :public Item_func_not { /* allow to check presence od values in max/min optimisation */ Item_sum_hybrid *test_sum_item; Item_maxmin_subselect *test_sub_item; bool abort_on_null; public: bool show; Item_func_not_all(Item *a) :Item_func_not(a), abort_on_null(0), show(0) {} Item_func_not_all(Item *a) :Item_func_not(a), test_sum_item(0), test_sub_item(0), abort_on_null(0), show(0) {} virtual void top_level_item() { abort_on_null= 1; } bool top_level() { return abort_on_null; } longlong val_int(); enum Functype functype() const { return NOT_ALL_FUNC; } const char *func_name() const { return "<not>"; } void print(String *str); void set_sum_test(Item_sum_hybrid *item) { test_sum_item= item; }; void set_sub_test(Item_maxmin_subselect *item) { test_sub_item= item; }; bool empty_underlying_subquery(); }; class Item_func_nop_all :public Item_func_not_all { public: Item_func_nop_all(Item *a) :Item_func_not_all(a) {} longlong val_int(); const char *func_name() const { return "<nop>"; } }; class Item_func_eq :public Item_bool_rowready_func2 { public: Loading
sql/item_subselect.cc +28 −7 Original line number Diff line number Diff line Loading @@ -271,7 +271,7 @@ Item_singlerow_subselect::Item_singlerow_subselect(st_select_lex *select_lex) Item_maxmin_subselect::Item_maxmin_subselect(Item_subselect *parent, st_select_lex *select_lex, bool max_arg) :Item_singlerow_subselect() :Item_singlerow_subselect(), was_values(TRUE) { DBUG_ENTER("Item_maxmin_subselect::Item_maxmin_subselect"); max= max_arg; Loading @@ -290,12 +290,26 @@ Item_maxmin_subselect::Item_maxmin_subselect(Item_subselect *parent, DBUG_VOID_RETURN; } void Item_maxmin_subselect::cleanup() { /* By default is is TRUE to avoid TRUE reporting by Item_func_not_all/Item_func_nop_all if this item was never called. Engine exec() set it to FALSE by reset_value_registration() call. */ was_values= TRUE; } void Item_maxmin_subselect::print(String *str) { str->append(max?"<max>":"<min>", 5); Item_singlerow_subselect::print(str); } void Item_singlerow_subselect::reset() { null_value= 1; Loading @@ -303,6 +317,7 @@ void Item_singlerow_subselect::reset() value->null_value= 1; } Item_subselect::trans_res Item_singlerow_subselect::select_transformer(JOIN *join) { Loading Loading @@ -519,7 +534,7 @@ bool Item_in_subselect::test_limit(SELECT_LEX_UNIT *unit) Item_in_subselect::Item_in_subselect(Item * left_exp, st_select_lex *select_lex): Item_exists_subselect(), transformed(0), upper_not(0) Item_exists_subselect(), transformed(0), upper_item(0) { DBUG_ENTER("Item_in_subselect::Item_in_subselect"); left_expr= left_exp; Loading Loading @@ -680,7 +695,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, NULL/IS NOT NULL functions). If so, we rewrite ALL/ANY with NOT EXISTS later in this method. */ if ((abort_on_null || (upper_not && upper_not->top_level())) && if ((abort_on_null || (upper_item && upper_item->top_level())) && !select_lex->master_unit()->uncacheable && !func->eqne_op()) { if (substitution) Loading @@ -694,7 +709,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, !select_lex->with_sum_func && !(select_lex->next_select())) { Item *item; Item_sum_hybrid *item; if (func->l_op()) { /* Loading @@ -711,6 +726,8 @@ Item_in_subselect::single_value_transformer(JOIN *join, */ item= new Item_sum_min(*select_lex->ref_pointer_array); } if (upper_item) upper_item->set_sum_test(item); *select_lex->ref_pointer_array= item; { List_iterator<Item> it(select_lex->item_list); Loading @@ -731,10 +748,13 @@ Item_in_subselect::single_value_transformer(JOIN *join, } else { Item_maxmin_subselect *item; // remove LIMIT placed by ALL/ANY subquery select_lex->master_unit()->global_parameters->select_limit= HA_POS_ERROR; subs= new Item_maxmin_subselect(this, select_lex, func->l_op()); subs= item= new Item_maxmin_subselect(this, select_lex, func->l_op()); if (upper_item) upper_item->set_sub_test(item); } // left expression belong to outer select SELECT_LEX *current= thd->lex->current_select, *up; Loading Loading @@ -1041,8 +1061,8 @@ Item_subselect::trans_res Item_allany_subselect::select_transformer(JOIN *join) { transformed= 1; if (upper_not) upper_not->show= 1; if (upper_item) upper_item->show= 1; return single_value_transformer(join, func); } Loading Loading @@ -1247,6 +1267,7 @@ int subselect_single_select_engine::exec() } if (!executed) { item->reset_value_registration(); join->exec(); executed= 1; join->thd->where= save_where; Loading