summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2007-05-16 23:42:10 -0700
committerunknown <igor@olga.mysql.com>2007-05-16 23:42:10 -0700
commitdd1a11800027ab621479e1424963118b59a45e64 (patch)
tree573abbd7776f17f3f6cb5d3bfec829f402b74e8a /sql/item.cc
parent418a2983c0c400b1008f6dc748a9bddfd0a0678f (diff)
downloadmariadb-git-dd1a11800027ab621479e1424963118b59a45e64.tar.gz
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.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 30486e7559a..60c5b3b4a8c 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -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;
/*