1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

MDEV-28619 with_flags cleanup

The best practice is to init as much info as possible in class
constructor. with_flags access may be needed before fix_fields() or
fix_fields() may be not called at all like it takes place in
MDEV-28619. The fix for MDEV-28619 requires WINDOW_FUNC check on
unfixed item.
This commit is contained in:
Aleksey Midenkov
2026-03-26 23:14:55 +03:00
parent 4b1b67e481
commit 6d9f47cbdb
2 changed files with 10 additions and 3 deletions

View File

@@ -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;

View File

@@ -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]; }