Commit a7964606 authored by unknown's avatar unknown

fixed optimized SOME subquery


mysql-test/r/subselect.result:
  correct results of SOME subquery
sql/item_cmpfunc.cc:
  some comments added
  fixed optimized SOME subquery
parent b41b1681
......@@ -1490,9 +1490,6 @@ 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
......@@ -1512,9 +1509,6 @@ 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
......
......@@ -120,7 +120,7 @@ longlong Item_func_not_all::val_int()
/*
return TRUE if there was records in underlaying select in max/min
optimisation
optimisation (ALL subquery)
*/
if (empty_underlying_subquery())
return 1;
......@@ -157,11 +157,11 @@ longlong Item_func_nop_all::val_int()
double value= args[0]->val();
/*
return TRUE if there was records in underlaying select in max/min
optimisation
return FALSE if there was records in underlaying select in max/min
optimisation (SAME/ANY subquery)
*/
if (empty_underlying_subquery())
return 1;
return 0;
null_value= args[0]->null_value;
return (null_value || value == 0) ? 0 : 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment