[Commits] e4f1094c507: MDEV-7468 Fix for crash caused by connect.json_udf test
revision-id: e4f1094c5074e4931cca82fc45a82c1fe1ac8963 (mariadb-10.3.6-124-ge4f1094c507) parent(s): 7a77b221f18c74c6e6e04bf7a211647d22a7a8b7 author: Galina Shalygina committer: Galina Shalygina timestamp: 2019-02-18 20:37:23 +0300 message: 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. --- sql/item.cc | 17 +++++++++++++++++ sql/item.h | 14 +------------- sql/item_func.h | 2 ++ 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index a39943e7e36..e5b833bcc9b 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -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 && diff --git a/sql/item.h b/sql/item.h index 8bd03b23fee..4feaebfcd23 100644 --- a/sql/item.h +++ b/sql/item.h @@ -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) diff --git a/sql/item_func.h b/sql/item_func.h index 3bf58275f52..6408cf4dd55 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -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;} };
participants (1)
-
Galina