mirror of
https://github.com/MariaDB/server.git
synced 2025-11-27 05:41:41 +03:00
Aggregate functions: only create list if args exist
Also always empty list rather than only if there is no error.
This commit is contained in:
committed by
Sergey Vojtovich
parent
4e7ee166a9
commit
a3ccad0f21
@@ -6515,17 +6515,20 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
|
|||||||
|
|
||||||
if (m_sp->agg_type() == GROUP_AGGREGATE)
|
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;
|
Item_sum_sp *item_sp;
|
||||||
Query_arena *arena, backup;
|
Query_arena *arena, backup;
|
||||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||||
|
|
||||||
if (arg_count)
|
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);
|
item_sp= new (thd->mem_root) Item_sum_sp(thd, context, m_name, sp, list);
|
||||||
|
list.empty();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
item_sp= new (thd->mem_root) Item_sum_sp(thd, context, m_name, sp);
|
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)
|
if (err)
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
|
||||||
list.empty();
|
|
||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user