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

Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #2 0x00000000007bf65c in handle_fatal_signal (sig=11) at sql/signal_handler.cc:279 #3 <signal handler called> #4 0x0000000000669c2f in test_if_skip_sort_order (tab=0x35c4570, order=0x35bf238, select_limit=1, no_changes=false, map=0x35c0e80) at sql/sql_select.cc:18605 #5 0x0000000000641d94 in JOIN::exec (this=0x35c0578) at sql/sql_select.cc:2330 #6 0x0000000000644581 in mysql_select (thd=0x34a56a0, rref_pointer_array=0x35a89a8, tables=0x35a92c0, wild_num=0, fields=..., conds=0x35c3078, og_num=1, order=0x0, group=0x35bf238, having=0x35bf408, proc_param=0x0, select_options=2147748612, result=0x35bf788, unit=0x35a8a98, select_lex=0x35a8750) at sql/sql_select.cc:3044 #7 0x0000000000672e7c in mysql_explain_union (thd=0x34a56a0, unit=0x35a8a98, result=0x35bf788) at sql/sql_select.cc:21914 #8 0x0000000000672b93 in select_describe (join=0x35bfe48, need_tmp_table=false, need_order=false, distinct=false, message=0xd2f7cf "Impossible WHERE") at sql/sql_select.cc:21871 #9 0x0000000000657a81 in return_zero_rows (join=0x35bfe48, result=0x35bf788, tables=..., fields=..., send_row=false, select_options=2147748612, info=0xd2f7cf "Impossible WHERE", having=0x0, all_fields=...) at sql/sql_select.cc:10994 #10 0x0000000000641a43 in JOIN::exec (this=0x35bfe48) at sql/sql_select.cc:2277 #11 0x0000000000644581 in mysql_select (thd=0x34a56a0, rref_pointer_array=0x34a8358, tables=0x35a8170, wild_num=1, fields=..., conds=0x35bf578, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748612, result=0x35bf788, unit=0x34a7a28, select_lex=0x34a8100) at sql/sql_select.cc:3044 #12 0x0000000000672e7c in mysql_explain_union (thd=0x34a56a0, unit=0x34a7a28, result=0x35bf788) at sql/sql_select.cc:21914 #13 0x0000000000614255 in execute_sqlcom_select (thd=0x34a56a0, all_tables=0x35a8170) at sql/sql_parse.cc:4592 #14 0x000000000060cf7e in mysql_execute_command (thd=0x34a56a0) at sql/sql_parse.cc:2189 #15 0x0000000000616ca1 in mysql_parse (thd=0x34a56a0, rawbuf=0x35a7ee8 "EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 )", length=99, parser_state=0x7f831f63d500) at sql/sql_parse.cc:5736 #16 0x000000000060a517 in dispatch_command (command=COM_QUERY, thd=0x34a56a0, packet=0x35a06d1 "", packet_length=100) at sql/sql_parse.cc:1055 #17 0x00000000006097ce in do_command (thd=0x34a56a0) at sql/sql_parse.cc:794 #18 0x000000000070ac27 in do_handle_one_connection (thd_arg=0x34a56a0) at sql/sql_connect.cc:1253 #19 0x000000000070a612 in handle_one_connection (arg=0x34a56a0) at sql/sql_connect.cc:1168 #20 0x0000000000c015ef in pfs_spawn_thread (arg=0x3629100) at storage/perfschema/pfs.cc:1015 #21 0x00007f832ac9aefc in start_thread (arg=0x7f831f63e700) at pthread_create.c:304 #22 0x00007f832a00d59d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

bzr version-info

1 2 3 4 revision-id: axel@mysql.com-20120719112424-dszclm7cekcji8bw date: 2012-07-19 13:24:24 +0200 build-date: 2012-07-20 00:36:09 +0400 revno: 3470

I suppose it's a regression from MDEV-193, as it appeared with revno 3445 (reproducible on 3445, not reproducible on 3444).

Reproducible with MyISAM, Aria, InnoDB;.

Minimal optimizer_switch:

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,engine_condition_pushdown=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,extended_keys=off

Test case:

1 2 3 4 5 6 7 CREATE TABLE t1 (a INT, KEY(a)); INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;





Sergei Petrunia


Elena Stepanova



External issue ID


External issue ID


Fix versions

Affects versions