summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-06-23 14:48:45 -0700
committerIgor Babaev <igor@askmonty.org>2011-06-23 14:48:45 -0700
commit3cf0d6f446b51b76a53378a11a117a134158f407 (patch)
treedd1fdd620dea52b00c2b3fb8ed728a8b0f4c6acc /sql/opt_sum.cc
parent1f6b32bc370f5a0f05ab0e1ee79ede6bb58b71d4 (diff)
downloadmariadb-git-3cf0d6f446b51b76a53378a11a117a134158f407.tar.gz
Fixed LP bug #800518.
The function simple_pred did not take into account that a multiple equality could include ref items (more exactly items of the class Item_direct_view_ref). It caused crashes for queries over derived tables or views if the min/max optimization could be applied to these queries.
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 965eb853471..78cb2fa8210 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -494,11 +494,13 @@ bool simple_pred(Item_func *func_item, Item **args, bool *inv_order)
/* MULT_EQUAL_FUNC */
{
Item_equal *item_equal= (Item_equal *) func_item;
+ if (!(args[1]= item_equal->get_const()))
+ return 0;
Item_equal_fields_iterator it(*item_equal);
- args[0]= it++;
- if (it++)
+ if (!(item= it++))
return 0;
- if (!(args[1]= item_equal->get_const()))
+ args[0]= item->real_item();
+ if (it++)
return 0;
}
break;