If one looks at the source of the problem, they will find that the execution is an odd state. Here is the stack trace of the crash, with unneeded details removed:
(gdb) wher
#0 in do_select (join=$JOIN1, fields=0x9f68b14, table=0x0, procedure=0x0)
#1 in JOIN::exec (this=$JOIN1)
#2 in subselect_single_select_engine::exec ()
#3 in Item_subselect::exec ()
#4 in Item_singlerow_subselect::val_str ()
#5 in Item_func_conv_charset::Item_func_conv_charset ()
#6 in Item::safe_charset_converter ()
#7 in agg_item_set_converter ()
#8 in agg_item_charsets ()
#9 in Item_func::agg_arg_charsets ()
#10 in Item_bool_func2::fix_length_and_dec ()
#11 in Item_func::fix_fields ()
#12 in Item_allany_subselect::transform_into_max_min (this=0x9f3a1f8, join=$JOIN1)
#13 in JOIN::transform_max_min_subquery (this=$JOIN1)
#14 in JOIN::optimize (this=$JOIN1)
#15 in st_select_lex::optimize_unflattened_subqueries (this=0x9f30198)
#16 in JOIN::optimize_unflattened_subqueries (this=$JOIN2)
#17 in JOIN::optimize (this=$JOIN2)
#18 in mysql_select ()
Note that we're inside JOIN::optimize (this=$JOIN1) , #14. And what we're trying to do is to call JOIN::exec (this=$JOIN1) for the same join object. This is wrong: optimization of a join should not involve attempts to execute the join we're trying to optimize.
I think, something is wrong with type conversions and/or MIN/MAX transformations.
The crash itself happens on these lines:
15035 if (join->table_count) tab[join- >top_join_ tab_count - 1].next_select= end_select; join->join_ tab+join- >const_ tables;
15036 {
15037 join->join_
15038 join_tab=
15039 }
because
(gdb) p join->top_ join_tab_ count
$82 = 0
If one looks at the source of the problem, they will find that the execution is an odd state. Here is the stack trace of the crash, with unneeded details removed:
(gdb) wher single_ select_ engine: :exec () :exec () subselect: :val_str () conv_charset: :Item_func_ conv_charset () charset_ converter () set_converter () :agg_arg_ charsets () func2:: fix_length_ and_dec () :fix_fields () subselect: :transform_ into_max_ min (this=0x9f3a1f8, join=$JOIN1) _max_min_ subquery (this=$JOIN1) lex::optimize_ unflattened_ subqueries (this=0x9f30198) unflattened_ subqueries (this=$JOIN2)
#0 in do_select (join=$JOIN1, fields=0x9f68b14, table=0x0, procedure=0x0)
#1 in JOIN::exec (this=$JOIN1)
#2 in subselect_
#3 in Item_subselect:
#4 in Item_singlerow_
#5 in Item_func_
#6 in Item::safe_
#7 in agg_item_
#8 in agg_item_charsets ()
#9 in Item_func:
#10 in Item_bool_
#11 in Item_func:
#12 in Item_allany_
#13 in JOIN::transform
#14 in JOIN::optimize (this=$JOIN1)
#15 in st_select_
#16 in JOIN::optimize_
#17 in JOIN::optimize (this=$JOIN2)
#18 in mysql_select ()
Note that we're inside JOIN::optimize (this=$JOIN1) , #14. And what we're trying to do is to call JOIN::exec (this=$JOIN1) for the same join object. This is wrong: optimization of a join should not involve attempts to execute the join we're trying to optimize.
I think, something is wrong with type conversions and/or MIN/MAX transformations.