MDEV-7468 Fix for crash caused by connect.json_udf test

It was allowed to push UDF functions and that caused a crash.
To fix it it was forbidden to push UDF functions from HAVING into WHERE.
This commit is contained in:
Galina Shalygina 2019-02-18 20:37:23 +03:00
parent 7a77b221f1
commit e4f1094c50
3 changed files with 20 additions and 13 deletions

View File

@ -9108,6 +9108,23 @@ bool Item_direct_view_ref::excl_dep_on_group_fields_for_having_pushdown(st_selec
}
bool Item_args::excl_dep_on_group_fields_for_having_pushdown(st_select_lex *sel)
{
for (uint i= 0; i < arg_count; i++)
{
if (args[i]->type() == Item::SUBSELECT_ITEM ||
(args[i]->type() == Item::FUNC_ITEM &&
((Item_func *)args[i])->functype() == Item_func::UDF_FUNC))
return false;
if (args[i]->const_item())
continue;
if (!args[i]->excl_dep_on_group_fields_for_having_pushdown(sel))
return false;
}
return true;
}
bool Item_default_value::eq(const Item *item, bool binary_cmp) const
{
return item->type() == DEFAULT_VALUE_ITEM &&

View File

@ -2523,19 +2523,7 @@ protected:
}
return true;
}
bool excl_dep_on_group_fields_for_having_pushdown(st_select_lex *sel)
{
for (uint i= 0; i < arg_count; i++)
{
if (args[i]->type() == Item::SUBSELECT_ITEM)
return false;
if (args[i]->const_item())
continue;
if (!args[i]->excl_dep_on_group_fields_for_having_pushdown(sel))
return false;
}
return true;
}
bool excl_dep_on_group_fields_for_having_pushdown(st_select_lex *sel);
public:
Item_args(void)
:args(NULL), arg_count(0)

View File

@ -2327,6 +2327,8 @@ public:
}
bool excl_dep_on_grouping_fields(st_select_lex *sel)
{ return false; }
bool excl_dep_on_group_fields_for_having_pushdown(st_select_lex *sel)
{ return false;}
};