Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) in a non-correlated subquery (5.5-show-explain tree)

Description

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #3 <signal handler called> #4 0x00000000008c1113 in SQL_SELECT::cleanup (this=0x3713958) at sql/opt_range.cc:1739 #5 0x000000000066c549 in JOIN::clean_pre_sort_join_tab (this=0x3710970) at sql/sql_select.cc:19218 #6 0x0000000000658509 in JOIN::cleanup (this=0x3710970, full=true) at sql/sql_select.cc:10759 #7 0x0000000000645899 in JOIN::destroy (this=0x3710970) at sql/sql_select.cc:2974 #8 0x00000000006bfe11 in st_select_lex::cleanup (this=0x36efd78) at sql/sql_union.cc:989 #9 0x00000000006bf9e3 in st_select_lex_unit::cleanup (this=0x36f00c8) at sql/sql_union.cc:854 #10 0x00000000006bfe6b in st_select_lex::cleanup (this=0x35fe8b8) at sql/sql_union.cc:996 #11 0x00000000006bf9e3 in st_select_lex_unit::cleanup (this=0x35fe1e0) at sql/sql_union.cc:854 #12 0x000000000061565d in mysql_execute_command (thd=0x35fbe30) at sql/sql_parse.cc:4549 #13 0x000000000061845d in mysql_parse (thd=0x35fbe30, rawbuf=0x36ef308 "EXPLAIN SELECT * FROM t1 \nWHERE ( 8, 89 ) IN ( SELECT b, SUM( DISTINCT b ) FROM t2 GROUP BY b )", length=95, parser_state=0x7f8a9501e500) at sql/sql_parse.cc:5763 #14 0x000000000060bb58 in dispatch_command (command=COM_QUERY, thd=0x35fbe30, packet=0x377f391 "", packet_length=95) at sql/sql_parse.cc:1056 #15 0x000000000060ae0f in do_command (thd=0x35fbe30) at sql/sql_parse.cc:795 #16 0x000000000070d3ff in do_handle_one_connection (thd_arg=0x35fbe30) at sql/sql_connect.cc:1253 #17 0x000000000070cdea in handle_one_connection (arg=0x35fbe30) at sql/sql_connect.cc:1168 #18 0x0000000000c047e3 in pfs_spawn_thread (arg=0x377e0f0) at storage/perfschema/pfs.cc:1015 #19 0x00007f8aa067befc in start_thread (arg=0x7f8a9501f700) at pthread_create.c:304 #20 0x00007f8a9f9ee59d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

Reproducible with MyISAM, Aria, InnoDB.
Reproducible with the default optimizer_switch as well as with all OFF values (except for in_to_exists=on which is required).
Not reproducible on maria/5.5 revno 3473.

bzr version-info

1 2 3 4 revision-id: psergey@askmonty.org-20120727121752-5dmlp1nkhrn01ab5 date: 2012-07-27 16:17:52 +0400 build-date: 2012-07-28 02:17:54 +0400 revno: 3460

Test case:

1 2 3 4 5 6 7 8 CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2 (b INT); INSERT INTO t2 VALUES (8),(9); EXPLAIN SELECT * FROM t1 WHERE ( 8, 89 ) IN ( SELECT b, SUM( DISTINCT b ) FROM t2 GROUP BY b );

Environment

5.5-show-explain tree

Status

Assignee

Sergei Petrunia

Reporter

Elena Stepanova

Labels

None

External issue ID

None

External issue ID

None

Fix versions

Priority

Major
Configure