summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index cfd3daad65c..2578cbb3a52 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1782,7 +1782,14 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
((Item_field*) item)->table_name,&it))
DBUG_RETURN(-1); /* purecov: inspected */
if (sum_func_list)
- sum_func_list->elements += fields.elements - elem;
+ {
+ /*
+ sum_func_list is a list that has the fields list as a tail.
+ Because of this we have to update the element count also for this
+ list after expanding the '*' entry.
+ */
+ sum_func_list->elements+= fields.elements - elem;
+ }
}
else
{