Commit e4f1094c authored by Galina Shalygina's avatar Galina Shalygina

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.
parent 7a77b221
......@@ -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 &&
......
......@@ -2523,19 +2523,7 @@ class Item_args
}
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)
......
......@@ -2327,6 +2327,8 @@ class Item_udf_func :public Item_func
}
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;}
};
......
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