Commit a3ccad0f authored by Daniel Black's avatar Daniel Black Committed by Sergey Vojtovich

Aggregate functions: only create list if args exist

Also always empty list rather than only if there is no error.
parent 4e7ee166
......@@ -6515,17 +6515,20 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
if (m_sp->agg_type() == GROUP_AGGREGATE)
{
List<Item> list;
list.empty();
for (uint i=0; i < arg_count; i++)
list.push_back(*(args+i));
Item_sum_sp *item_sp;
Query_arena *arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup);
if (arg_count)
{
List<Item> list;
list.empty();
for (uint i=0; i < arg_count; i++)
list.push_back(*(args+i));
item_sp= new (thd->mem_root) Item_sum_sp(thd, context, m_name, sp, list);
list.empty();
}
else
item_sp= new (thd->mem_root) Item_sum_sp(thd, context, m_name, sp);
......@@ -6539,7 +6542,6 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
if (err)
DBUG_RETURN(TRUE);
list.empty();
DBUG_RETURN(FALSE);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment