diff options
author | Olav Sandstaa <olav@sun.com> | 2010-07-08 15:19:05 +0200 |
---|---|---|
committer | Olav Sandstaa <olav@sun.com> | 2010-07-08 15:19:05 +0200 |
commit | b7166f33d05a815b320b2783a719c9b3a11a2beb (patch) | |
tree | b8f34fe60e5b51c7f660a6a42368b3a51d2b6a77 /sql | |
parent | 65bdafda29864697100260e4726b90166b122050 (diff) | |
download | mariadb-git-b7166f33d05a815b320b2783a719c9b3a11a2beb.tar.gz |
Backporting of jorgen.loland@sun.com-20100618093212-lifp1psig3hbj6jj
from mysql-next-mr-opt-backporting.
Bug#54515: Crash in opt_range.cc::get_best_group_min_max on
SELECT from VIEW with GROUP BY
When handling the grouping items in get_best_group_min_max, the
items need to be of type Item_field. In this bug, an ASSERT
triggered because the item used for grouping was an
Item_direct_view_ref (i.e., the group column is from a view).
The fix is to get the real_item since Item_ref* pointing to
Item_field is ok.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/opt_range.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 995582fc6ee..f195da9ae02 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -9570,8 +9570,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) first Item? If so, then why? What is the array for? */ /* Above we already checked that all group items are fields. */ - DBUG_ASSERT((*tmp_group->item)->type() == Item::FIELD_ITEM); - Item_field *group_field= (Item_field *) (*tmp_group->item); + DBUG_ASSERT((*tmp_group->item)->real_item()->type() == Item::FIELD_ITEM); + Item_field *group_field= (Item_field *) (*tmp_group->item)->real_item(); if (group_field->field->eq(cur_part->field)) { cur_group_prefix_len+= cur_part->store_length; |