Fixed MDEV-5617: mysqld crashes when running a query with ONLY_FULL_GROUP_BY

Problem was that we used cache_table in some cases where it was not initialized

mysql-test/r/func_group.result:
  Added test case
mysql-test/t/func_group.test:
  Added test case
sql/item.cc:
  Don't use cached_table if not set
sql/item_sum.cc:
  Don't use cached_table
This commit is contained in:
Michael Widenius 2014-02-11 16:58:49 +02:00
commit 1bdf2151da
4 changed files with 32 additions and 8 deletions

View file

@ -261,7 +261,7 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
List_iterator<Item_field> of(outer_fields);
while ((field= of++))
{
SELECT_LEX *sel= field->cached_table->select_lex;
SELECT_LEX *sel= field->field->table->pos_in_table_list->select_lex;
if (sel->nest_level < aggr_level)
{
if (in_sum_func)