RQG: crash in Item_ref::val_str with subquery cache
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Oleksandr "Sanja" Byelkin |
Bug Description
This query:
SELECT SUBQUERY2_t1 .`col_int_key`
FROM B SUBQUERY2_t1 JOIN CC ON SUBQUERY2_t1 .`col_int_key`
WHERE table1 .`col_varchar_key` ) , table2 .`col_varchar_
FROM D table1 JOIN ( C table2 STRAIGHT_JOIN C table3 ON table2 .`pk` ) ON table3 .`col_varchar_key` = table2 .`col_varchar_key`
GROUP BY field10 ;
causes the following backtrace:
#3 0x0827e8f8 in handle_segfault (sig=11) at mysqld.cc:2703
#4 <signal handler called>
#5 0x081c7bd8 in Item_ref::val_str (this=0xb5e461d8, tmp=0xb5e463c0) at item.cc:6465
#6 0x081f8fe0 in Arg_comparator:
#7 0x081deb78 in Arg_comparator:
#8 0x081fad0f in Item_func_
#9 0x0849757e in Expression_
#10 0x081c8556 in Item_cache_
#11 0x081c8a6c in Item_cache_
#12 0x081c0c84 in Item_copy_
#13 0x08327ae8 in copy_fields (param=0xb5e3fecc) at sql_select.cc:17251
#14 0x083202ab in end_send_group (join=0xb5e3b238, join_tab=
#15 0x0831df08 in evaluate_
#16 0x0831d8af in sub_select (join=0xb5e3b238, join_tab=
#17 0x0831df08 in evaluate_
#18 0x0831d9fd in sub_select (join=0xb5e3b238, join_tab=
#19 0x0831ccae in do_select (join=0xb5e3b238, fields=0xb5e3ffd8, table=0x0, procedure=0x0) at sql_select.cc:12649
#20 0x083030cf in JOIN::exec (this=0xb5e3b238) at sql_select.cc:2355
#21 0x08303802 in mysql_select (thd=0xae49e90, rref_pointer_
group=
#22 0x082fbecf in handle_select (thd=0xae49e90, lex=0xae4b50c, result=0xb5e158e8, setup_tables_
#23 0x0829a5f0 in execute_
#24 0x08290fd0 in mysql_execute_
#25 0x0829c7d1 in mysql_parse (thd=0xae49e90,
inBuf=
#26 0x0828ea02 in dispatch_command (command=COM_QUERY, thd=0xae49e90, packet=0xae62271 "", packet_length=397) at sql_parse.cc:1184
#27 0x0828dea8 in do_command (thd=0xae49e90) at sql_parse.cc:890
#28 0x0828b008 in handle_
#29 0x00a08919 in start_thread () from /lib/libpthread
#30 0x00951e5e in clone () from /lib/libc.so.6
Changed in maria: | |
status: | New → In Progress |
Changed in maria: | |
status: | In Progress → Fix Committed |
Changed in maria: | |
milestone: | none → 5.3 |
Changed in maria: | |
status: | Fix Committed → Fix Released |
Partially- simplified test case below. Unfortunately unnecessary fields could not be removed:
CREATE TABLE `C` ( datetime_ key` datetime DEFAULT NULL, datetime_ nokey` datetime DEFAULT NULL, varchar_ nokey` varchar(1) DEFAULT NULL, key`,`col_ int_key` ) 6,'2004- 08-20', '2004-08- 20','05: 03:03', '05:03: 03','2007- 04-19 00:19:53' ,'2007- 04-19 00:19:53','f','f'); '1900-01- 01','1900- 01-01', '18:38: 59','18: 38:59', '1900-01- 01 00:00:00' ,'1900- 01-01 00:00:00','d','d');
`pk` int(11) NOT NULL AUTO_INCREMENT,
`col_int_nokey` int(11) DEFAULT NULL,
`col_int_key` int(11) DEFAULT NULL,
`col_date_key` date DEFAULT NULL,
`col_date_nokey` date DEFAULT NULL,
`col_time_key` time DEFAULT NULL,
`col_time_nokey` time DEFAULT NULL,
`col_
`col_
`col_varchar_key` varchar(1) DEFAULT NULL,
`col_
PRIMARY KEY (`pk`),
KEY `col_varchar_key` (`col_varchar_
) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
INSERT INTO `C` VALUES (19,NULL,
INSERT INTO `C` VALUES (20,4,2,
CREATE TABLE `CC` ( datetime_ key` datetime DEFAULT NULL, datetime_ nokey` datetime DEFAULT NULL, varchar_ nokey` varchar(1) DEFAULT NULL, key`), key`,`col_ int_key` )
`pk` int(11) NOT NULL AUTO_INCREMENT,
`col_int_nokey` int(11) DEFAULT NULL,
`col_int_key` int(11) DEFAULT NULL,
`col_date_key` date DEFAULT NULL,
`col_date_nokey` date DEFAULT NULL,
`col_time_key` time DEFAULT NULL,
`col_time_nokey` time DEFAULT NULL,
`col_
`col_
`col_varchar_key` varchar(1) DEFAULT NULL,
`col_
PRIMARY KEY (`pk`),
KEY `col_int_key` (`col_int_key`),
KEY `col_date_key` (`col_date_key`),
KEY `col_time_key` (`col_time_key`),
KEY `col_datetime_key` (`col_datetime_
KEY `col_varchar_key` (`col_varchar_
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
CREATE TABLE `B` ( datetime_ key` datetime DEFAULT NULL, datetime_ nokey` datetime DEFAULT NULL, varchar_ nokey` varchar(1) DEFAULT NULL, key`), key`,`col_ int_key` )
`pk` int(11) NOT NULL AUTO_INCREMENT,
`col_int_nokey` int(11) DEFAULT NULL,
`col_int_key` int(11) DEFAULT NULL,
`col_date_key` date DEFAULT NULL,
`col_date_nokey` date DEFAULT NULL,
`col_time_key` time DEFAULT NULL,
`col_time_nokey` time DEFAULT NULL,
`col_
`col_
`col_varchar_key` varchar(1) DEFAULT NULL,
`col_
PRIMARY KEY (`pk`),
KEY `col_int_key` (`col_int_key`),
KEY `col_date_key` (`col_date_key`),
KEY `col_time_key` (`col_time_key`),
KEY `col_datetime_key` (`col_datetime_
KEY `col_varchar_key` (`col_varchar_
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
CREATE TABLE `D` ( datetime_ key` datetime DEFAULT NULL, datetime_ nokey` datetime DEFAULT NULL, varchar_ nokey` varchar(1) DEFAULT NULL, key`), key`,`. ..
`pk` int(11) NOT NULL AUTO_INCREMENT,
`col_int_nokey` int(11) DEFAULT NULL,
`col_int_key` int(11) DEFAULT NULL,
`col_date_key` date DEFAULT NULL,
`col_date_nokey` date DEFAULT NULL,
`col_time_key` time DEFAULT NULL,
`col_time_nokey` time DEFAULT NULL,
`col_
`col_
`col_varchar_key` varchar(1) DEFAULT NULL,
`col_
PRIMARY KEY (`pk`),
KEY `col_int_key` (`col_int_key`),
KEY `col_date_key` (`col_date_key`),
KEY `col_time_key` (`col_time_key`),
KEY `col_datetime_key` (`col_datetime_
KEY `col_varchar_key` (`col_varchar_