Skip to content

Commit 0e71b34

Browse files
roylysengprashanttekriwal
authored andcommitted
Bug#35846221: Assertion Failure in /mysql-8.0.34/sql/field.cc:7119
Problem is due to missing implementation of Item_func_make_set::fix_after_pullout(), which makes this particular MAKE_SET function be regarded as const and may thus be evaluated during resolving. Fixed by implementing a proper fix_after_pullout() function. Change-Id: I7094869588ce4133c4a925e1a237a37866a5bb3c (cherry picked from commit a9f0b388adeef837811fdba2bce2e4ba5b06863b)
1 parent 13dcbab commit 0e71b34

File tree

2 files changed

+33
-9
lines changed

2 files changed

+33
-9
lines changed

sql/item_strfunc.cc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3310,6 +3310,36 @@ void Item_func_make_set::fix_length_and_dec()
33103310
with_sum_func= with_sum_func || item->with_sum_func;
33113311
}
33123312

3313+
bool Item_func_make_set::fix_fields(THD *thd, Item **ref) {
3314+
assert(!fixed);
3315+
if (!item->fixed && item->fix_fields(thd, &item)) {
3316+
return true;
3317+
}
3318+
if (item->check_cols(1)) {
3319+
return true;
3320+
}
3321+
if (Item_func::fix_fields(thd, ref)) {
3322+
return true;
3323+
}
3324+
if (item->maybe_null) {
3325+
maybe_null = true;
3326+
}
3327+
3328+
used_tables_cache|= item->used_tables();
3329+
not_null_tables_cache|= item->not_null_tables();
3330+
const_item_cache&= item->const_item();
3331+
3332+
return false;
3333+
}
3334+
3335+
void Item_func_make_set::fix_after_pullout(st_select_lex *parent_select,
3336+
st_select_lex *removed_select) {
3337+
Item_func::fix_after_pullout(parent_select, removed_select);
3338+
item->fix_after_pullout(parent_select, removed_select);
3339+
used_tables_cache|= item->used_tables();
3340+
not_null_tables_cache|= item->not_null_tables();
3341+
const_item_cache&= item->const_item();
3342+
}
33133343

33143344
void Item_func_make_set::update_used_tables()
33153345
{

sql/item_strfunc.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -834,15 +834,9 @@ class Item_func_make_set :public Item_str_func
834834

835835
virtual bool itemize(Parse_context *pc, Item **res);
836836
String *val_str(String *str);
837-
bool fix_fields(THD *thd, Item **ref)
838-
{
839-
assert(fixed == 0);
840-
bool res= ((!item->fixed && item->fix_fields(thd, &item)) ||
841-
item->check_cols(1) ||
842-
Item_func::fix_fields(thd, ref));
843-
maybe_null|= item->maybe_null;
844-
return res;
845-
}
837+
bool fix_fields(THD *thd, Item **ref);
838+
void fix_after_pullout(st_select_lex *parent_select,
839+
st_select_lex *removed_select);
846840
void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
847841
List<Item> &fields);
848842
void fix_length_and_dec();

0 commit comments

Comments
 (0)