diff options
author | unknown <evgen@moonbone.local> | 2007-04-15 08:31:34 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2007-04-15 08:31:34 +0400 |
commit | 321726e8672b055f9365fdb33ce49173d5f04ac4 (patch) | |
tree | db1a04d110b3d1a52904be6a4dc49835a46c7e4e /sql/sql_union.cc | |
parent | fbf7748f9a06c76166c2ee3b641d36c2d5a3b9c8 (diff) | |
download | mariadb-git-321726e8672b055f9365fdb33ce49173d5f04ac4.tar.gz |
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.
mysql-test/t/subselect3.test:
Some test cases were corrected after the fix for the bug#27321.
mysql-test/r/subselect3.result:
Some test cases were corrected after the fix for the bug#27321.
mysql-test/t/subselect.test:
Added a test case for the bug#27321: Wrong subquery result in a grouping select.
mysql-test/r/subselect.result:
Added a test case for the bug#27321: Wrong subquery result in a grouping select.
Some test cases were corrected after this fix.
sql/sql_union.cc:
Bug#27321: Wrong subquery result in a grouping select.
Cleanup of the inner_refs_list.
sql/sql_select.cc:
Bug#27321: Wrong subquery result in a grouping select.
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.
A comment is corrected.
sql/item.cc:
Bug#27321: Wrong subquery result in a grouping select.
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.
sql/item.h:
Bug#27321: Wrong subquery result in a grouping select.
The direct_ref and the found_in_select_list fields were added to the
Item_outer_ref class.
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 1ec724a6338..7fb75732012 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -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); } |