Fixed bug #28337: wrong results for grouping queries with correlated

subqueries in WHERE conditions.
This bug was introduced by the patch for bug 27321.


mysql-test/r/subselect.result:
  Added a test case for bug #28337.
mysql-test/t/subselect.test:
  Added a test case for bug #28337.
sql/item.cc:
  Fixed bug #28337: wrong results for grouping queries with correlated
  subqueries in WHERE conditions.
  This bug was introduced by the patch for bug 27321.
  
  Now in the Item_field::fix_outer_field function we create an Item_outer_ref
  object for an outer reference only if it is used in the SELECT list or
  in the HAVING clause of the subquery against which the reference is resolved.
This commit is contained in:
unknown 2007-05-16 23:42:10 -07:00
commit dd1a118000
3 changed files with 56 additions and 1 deletions

View file

@ -3503,7 +3503,8 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
prev_subselect_item->const_item_cache= 0;
set_field(*from_field);
if (!last_checked_context->select_lex->having_fix_field &&
select->group_list.elements)
select->group_list.elements &&
(place == SELECT_LIST || place == IN_HAVING))
{
Item_outer_ref *rf;
/*