1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug#27321: Wrong subquery result in a grouping select.

The Item_outer_ref class based on the Item_direct_ref class was always used
to represent an outer field. But if the outer select is a grouping one and the 
outer field isn't under an aggregate function which is aggregated in that
outer select an Item_ref object should be used to represent such a field.
If the outer select in which the outer field is resolved isn't grouping then
the Item_field class should be used to represent such a field.
This logic also should be used for an outer field resolved through its alias
name.

Now the Item_field::fix_outer_field() uses Item_outer_field objects to
represent aliased and non-aliased outer fields for grouping outer selects
only.
Now the fix_inner_refs() function chooses which class to use to access outer
field - the Item_ref or the Item_direct_ref. An object of the chosen class
substitutes the original field in the Item_outer_ref object.
The direct_ref and the found_in_select_list fields were added to the
Item_outer_ref class.
This commit is contained in:
evgen@moonbone.local
2007-04-15 08:31:34 +04:00
parent ce9cc47a73
commit 3113ce6383
8 changed files with 248 additions and 92 deletions

View File

@ -743,6 +743,7 @@ bool st_select_lex::cleanup()
error= (bool) ((uint) error | (uint) lex_unit->cleanup());
}
non_agg_fields.empty();
inner_refs_list.empty();
DBUG_RETURN(error);
}