[MDEV-416] Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) in a non-correlated subquery (5.5-show-explain tree) Created: 2012-07-28  Updated: 2012-08-02  Resolved: 2012-08-02

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: 10.0.0

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: None
Environment:

5.5-show-explain tree


Issue Links:
Relates

 Description   

 
#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

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:

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 );



 Comments   
Comment by Sergei Petrunia [ 2012-08-02 ]

Figured out how to fix without major rewrite

Generated at Thu Feb 08 06:28:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.