diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc index 5438cade27a..a770caa2222 100644 --- a/sql/item_windowfunc.cc +++ b/sql/item_windowfunc.cc @@ -124,7 +124,8 @@ Item_window_func::fix_fields(THD *thd, Item **ref) const_item_cache= false; - with_flags= (with_flags & ~item_with_t::SUM_FUNC) | item_with_t::WINDOW_FUNC; + DBUG_ASSERT((bool) (with_flags & item_with_t::WINDOW_FUNC)); + with_flags&= ~item_with_t::SUM_FUNC; if (fix_length_and_dec(thd)) return TRUE; diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index 8d78282d982..923732b4501 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -1086,13 +1086,19 @@ public: : Item_func_or_sum(thd, (Item *) win_func), window_name(win_name), window_spec(NULL), force_return_blank(true), - read_value_from_result_field(false) {} + read_value_from_result_field(false) + { + with_flags|= item_with_t::WINDOW_FUNC; + } Item_window_func(THD *thd, Item_sum *win_func, Window_spec *win_spec) : Item_func_or_sum(thd, (Item *) win_func), window_name(NULL), window_spec(win_spec), force_return_blank(true), - read_value_from_result_field(false) {} + read_value_from_result_field(false) + { + with_flags|= item_with_t::WINDOW_FUNC; + } Item_sum *window_func() const { return (Item_sum *) args[0]; }