fix the comparison in st_select_lex::setup_ref_array()
the array only needs to be reallocated if it's smaller than needed. Being larger is ok. also: remove a duplicated check (merge error)
This commit is contained in:
parent
5c30fcfa2f
commit
c917ba1d51
@ -494,8 +494,7 @@ Item::Item(THD *thd):
|
||||
{
|
||||
enum_parsing_place place=
|
||||
thd->lex->current_select->parsing_place;
|
||||
if (place == SELECT_LIST ||
|
||||
place == IN_HAVING)
|
||||
if (place == SELECT_LIST || place == IN_HAVING)
|
||||
thd->lex->current_select->select_n_having_items++;
|
||||
}
|
||||
}
|
||||
|
@ -116,9 +116,8 @@ void Item_subselect::init(st_select_lex *select_lex,
|
||||
do not take into account expression inside aggregate functions because
|
||||
they can access original table fields
|
||||
*/
|
||||
parsing_place= (outer_select->in_sum_expr ?
|
||||
NO_MATTER :
|
||||
outer_select->parsing_place);
|
||||
parsing_place= (outer_select->in_sum_expr ? NO_MATTER
|
||||
: outer_select->parsing_place);
|
||||
if (unit->is_union())
|
||||
engine= new subselect_union_engine(unit, result, this);
|
||||
else
|
||||
|
@ -2665,16 +2665,6 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num)
|
||||
order_group_num) * 5;
|
||||
if (!ref_pointer_array.is_null())
|
||||
{
|
||||
/*
|
||||
We need to take 'n_sum_items' into account when allocating the array,
|
||||
and this may actually increase during the optimization phase due to
|
||||
MIN/MAX rewrite in Item_in_subselect::single_value_transformer.
|
||||
In the usual case we can reuse the array from the prepare phase.
|
||||
If we need a bigger array, we must allocate a new one.
|
||||
*/
|
||||
if (ref_pointer_array.size() == n_elems)
|
||||
return false;
|
||||
|
||||
/*
|
||||
We need to take 'n_sum_items' into account when allocating the array,
|
||||
and this may actually increase during the optimization phase due to
|
||||
@ -2682,7 +2672,7 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num)
|
||||
In the usual case we can reuse the array from the prepare phase.
|
||||
If we need a bigger array, we must allocate a new one.
|
||||
*/
|
||||
if (ref_pointer_array.size() == n_elems)
|
||||
if (ref_pointer_array.size() >= n_elems)
|
||||
return false;
|
||||
}
|
||||
Item **array= static_cast<Item**>(arena->alloc(sizeof(Item*) * n_elems));
|
||||
|
Loading…
x
Reference in New Issue
Block a user