Commit a9457c57 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 3ce0df59
...@@ -1490,9 +1490,6 @@ Warnings: ...@@ -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))) 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); select * from t3 where a >= some (select b from t2);
a a
6
7
3
explain extended select * from t3 where a >= some (select b from t2); 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 id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
...@@ -1512,9 +1509,6 @@ Warnings: ...@@ -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))) 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); select * from t3 where a >= some (select b from t2 group by 1);
a a
6
7
3
explain extended 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);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
......
...@@ -120,7 +120,7 @@ longlong Item_func_not_all::val_int() ...@@ -120,7 +120,7 @@ longlong Item_func_not_all::val_int()
/* /*
return TRUE if there was records in underlaying select in max/min return TRUE if there was records in underlaying select in max/min
optimisation optimisation (ALL subquery)
*/ */
if (empty_underlying_subquery()) if (empty_underlying_subquery())
return 1; return 1;
...@@ -157,11 +157,11 @@ longlong Item_func_nop_all::val_int() ...@@ -157,11 +157,11 @@ longlong Item_func_nop_all::val_int()
double value= args[0]->val(); double value= args[0]->val();
/* /*
return TRUE if there was records in underlaying select in max/min return FALSE if there was records in underlaying select in max/min
optimisation optimisation (SAME/ANY subquery)
*/ */
if (empty_underlying_subquery()) if (empty_underlying_subquery())
return 1; return 0;
null_value= args[0]->null_value; null_value= args[0]->null_value;
return (null_value || value == 0) ? 0 : 1; 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