summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2010-07-06 19:16:24 +0400
committerSergey Petrunya <psergey@askmonty.org>2010-07-06 19:16:24 +0400
commite5f238a05152efbd4b05425511eeed59c3026779 (patch)
tree805c5aa19bef318c36f36012b31219aa4c0d50f3
parent0d734037ccabdb612e358db3fc91c7aaebf1c5ea (diff)
downloadmariadb-git-e5f238a05152efbd4b05425511eeed59c3026779.tar.gz
Fix buildbot valgrind failure
- Item_in_subselect::init_left_expr_cache() should not try to guess whether the left expression is accessed "over the grouping operation" (i.e. the subselect is evaluated after the grouping while the left_expr is an Item_ref that wraps an expression from before the grouping). Instead, let new_Cached_item not to try accessing item->real_item() when creating left expr cache.
-rw-r--r--sql/item.h2
-rw-r--r--sql/item_buff.cc7
-rw-r--r--sql/item_subselect.cc16
-rw-r--r--sql/sql_select.cc2
4 files changed, 6 insertions, 21 deletions
diff --git a/sql/item.h b/sql/item.h
index c6619382aef..8cab1c523f2 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -3414,7 +3414,7 @@ void mark_select_range_as_dependent(THD *thd,
Item_ident *resolved_item);
extern Cached_item *new_Cached_item(THD *thd, Item *item,
- bool use_result_field);
+ bool pass_through_ref);
extern Item_result item_cmp_type(Item_result a,Item_result b);
extern void resolve_const_item(THD *thd, Item **ref, Item *cmp_item);
extern int stored_field_cmp_to_item(THD *thd, Field *field, Item *item);
diff --git a/sql/item_buff.cc b/sql/item_buff.cc
index 037a988ebbc..13183a33e59 100644
--- a/sql/item_buff.cc
+++ b/sql/item_buff.cc
@@ -27,14 +27,13 @@
Create right type of Cached_item for an item.
*/
-Cached_item *new_Cached_item(THD *thd, Item *item, bool use_result_field)
+Cached_item *new_Cached_item(THD *thd, Item *item, bool pass_through_ref)
{
- if (item->real_item()->type() == Item::FIELD_ITEM &&
+ if (pass_through_ref && item->real_item()->type() == Item::FIELD_ITEM &&
!(((Item_field *) (item->real_item()))->field->flags & BLOB_FLAG))
{
Item_field *real_item= (Item_field *) item->real_item();
- Field *cached_field= use_result_field ? real_item->result_field :
- real_item->field;
+ Field *cached_field= real_item->field;
return new Cached_item_field(cached_field);
}
switch (item->result_type()) {
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index a20cc146531..0d0acdb29e4 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -2192,8 +2192,6 @@ bool Item_in_subselect::setup_engine()
bool Item_in_subselect::init_left_expr_cache()
{
JOIN *outer_join;
- Next_select_func end_select;
- bool use_result_field= FALSE;
outer_join= unit->outer_select()->join;
/*
@@ -2202,18 +2200,6 @@ bool Item_in_subselect::init_left_expr_cache()
*/
if (!outer_join || !outer_join->tables || !outer_join->tables_list)
return TRUE;
- /*
- If we use end_[send | write]_group to handle complete rows of the outer
- query, make the cache of the left IN operand use Item_field::result_field
- instead of Item_field::field. We need this because normally
- Cached_item_field uses Item::field to fetch field data, while
- copy_ref_key() that copies the left IN operand into a lookup key uses
- Item::result_field. In the case end_[send | write]_group result_field is
- one row behind field.
- */
- end_select= outer_join->join_tab[outer_join->tables-1].next_select;
- if (end_select == end_send_group || end_select == end_write_group)
- use_result_field= TRUE;
if (!(left_expr_cache= new List<Cached_item>))
return TRUE;
@@ -2222,7 +2208,7 @@ bool Item_in_subselect::init_left_expr_cache()
{
Cached_item *cur_item_cache= new_Cached_item(thd,
left_expr->element_index(i),
- use_result_field);
+ FALSE);
if (!cur_item_cache || left_expr_cache->push_front(cur_item_cache))
return TRUE;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 96dd01b9119..731f4a5901f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -16778,7 +16778,7 @@ alloc_group_fields(JOIN *join,ORDER *group)
{
for (; group ; group=group->next)
{
- Cached_item *tmp=new_Cached_item(join->thd, *group->item, FALSE);
+ Cached_item *tmp=new_Cached_item(join->thd, *group->item, TRUE);
if (!tmp || join->group_fields.push_front(tmp))
return TRUE;
}