We're updating the issue view to help you get more done. 

Assertion `fixed == 0' failed in Item_field::fix_fields on 2nd execution of PS with semijoin=on and IN subquery

Description

1 2 mysqld: item.cc:4601: virtual bool Item_field::fix_fields(THD*, Item**): Assertion `fixed == 0' failed. [ERROR] mysqld got signal 6 ;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #6 0x00007f6d506edd4d in __GI___assert_fail (assertion=0xcb195e "fixed == 0", file=<optimized out>, line=4601, function=<optimized out>) at assert.c:81 #7 0x00000000005bb5c4 in Item_field::fix_fields (this=0x3251488, thd=0x31d1580, reference=0x32517c8) at item.cc:4601 #8 0x0000000000654c18 in Item_row::fix_fields (this=0x3251708, thd=0x31d1580, ref=0x3252a40) at item_row.cc:71 #9 0x0000000000727274 in setup_conds (thd=0x31d1580, tables=0x3251058, leaves=..., conds=0x3252f90) at sql_base.cc:8574 #10 0x000000000077b096 in setup_without_group (thd=0x31d1580, ref_pointer_array=0x3253488, tables=0x3251058, leaves=..., fields=..., all_fields=..., conds=0x3252f90, order=0x0, group=0x0, hidden_group_fields=0x3252e47) at sql_select.cc:520 #11 0x000000000073e2ff in JOIN::prepare (this=0x3252b48, rref_pointer_array=0x32506a8, tables_init=0x3251058, wild_num=0, conds_init=0x32578a8, og_num=0, order_init=0x0, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x3250400, unit_arg=0x324fed8) at sql_select.cc:668 #12 0x0000000000746bfd in mysql_select (thd=0x31d1580, rref_pointer_array=0x32506a8, tables=0x3251058, wild_num=0, fields=..., conds=0x32578a8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416200192, result=0x3252af8, unit=0x324fed8, select_lex=0x3250400) at sql_select.cc:2963 #13 0x000000000073d6cb in handle_select (thd=0x31d1580, lex=0x324fe38, result=0x3252af8, setup_tables_done_option=0) at sql_select.cc:286 #14 0x00000000006c8bab in execute_sqlcom_select (thd=0x31d1580, all_tables=0x3251058) at sql_parse.cc:5157 #15 0x00000000006bf96a in mysql_execute_command (thd=0x31d1580) at sql_parse.cc:2290 #16 0x000000000079d6f9 in Prepared_statement::execute (this=0x3266d30, expanded_query=0x7f6d479f0be0, open_cursor=false) at sql_prepare.cc:3758 #17 0x000000000079c8f1 in Prepared_statement::execute_loop (this=0x3266d30, expanded_query=0x7f6d479f0be0, open_cursor=false, packet=0x0, packet_end=0x0) at sql_prepare.cc:3439 #18 0x000000000079ad2a in mysql_sql_stmt_execute (thd=0x31d1580) at sql_prepare.cc:2664 #19 0x00000000006bf99b in mysql_execute_command (thd=0x31d1580) at sql_parse.cc:2299 #20 0x00000000006cb603 in mysql_parse (thd=0x31d1580, rawbuf=0x32677d8 "execute stmt", length=12, found_semicolon=0x7f6d479f17e0) at sql_parse.cc:6158 #21 0x00000000006bd110 in dispatch_command (command=COM_QUERY, thd=0x31d1580, packet=0x321ab61 "execute stmt", packet_length=12) at sql_parse.cc:1228 #22 0x00000000006bc424 in do_command (thd=0x31d1580) at sql_parse.cc:923 #23 0x00000000006b8e7d in handle_one_connection (arg=0x31d1580) at sql_connect.cc:1218 #24 0x00007f6d511fcefc in start_thread (arg=0x7f6d479f2700) at pthread_create.c:304 #25 0x00007f6d507a3f4d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
1 2 3 4 branch: maria/5.3 revision-id: sergii@pisem.net-20121123121131-p4nfv8j2cbh68dbg date: 2012-11-23 13:11:31 +0100 revno: 3605

The assertion failure started happening from revno 3457 on maria/5.3 (which was some time between 5.3.5 and 5.3.6).
Reproducible on maria/5.3, maria/5.5, maria/10.0. Not reproducible on mysql/5.6.

Maybe it's only a problem of a debug build (nothing visibly wrong happens on a release build).

Minimal optimizer_switch: semijoin=on
Full optimizer_switch (default):

1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
1 2 3 4 5 6 7 8 9 10 11 12 SET optimizer_switch = 'semijoin=on'; CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (0,4),(8,6); CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM; INSERT INTO t2 VALUES (7,1),(0,7); eval PREPARE stmt FROM ' SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) '; execute stmt; execute stmt;

Environment

None

Status

Assignee

Oleksandr Byelkin

Reporter

Elena Stepanova

Labels

None

External issue ID

None

External issue ID

None

Fix versions

Affects versions

10.0.0
5.5.28
5.3.10

Priority

Major