The query for this bug is a superset of the query for bug #608824, but the backtrace is different. For some reason, automatic simplification was not possible so the originally generated, unsimplified query will be provided for this report.
backtrace:
#3 0x0827e8f8 in handle_segfault (sig=11) at mysqld.cc:2703
#4 <signal handler called>
#5 0x08327aa1 in copy_fields (param=0xb5e7877c) at sql_select.cc:17246
#6 0x083202ab in end_send_group (join=0xb5e73ae8, join_tab=0xb5e8b438, end_of_records=false) at sql_select.cc:14236
#7 0x0831df08 in evaluate_join_record (join=0xb5e73ae8, join_tab=0xb5e8b278, error=0) at sql_select.cc:13294
#8 0x0831d8af in sub_select (join=0xb5e73ae8, join_tab=0xb5e8b278, end_of_records=false) at sql_select.cc:13103
#9 0x0831df08 in evaluate_join_record (join=0xb5e73ae8, join_tab=0xb5e8b0b8, error=0) at sql_select.cc:13294
#10 0x0831d8af in sub_select (join=0xb5e73ae8, join_tab=0xb5e8b0b8, end_of_records=false) at sql_select.cc:13103
#11 0x0831ccae in do_select (join=0xb5e73ae8, fields=0xb5e78888, table=0x0, procedure=0x0) at sql_select.cc:12649
#12 0x083030cf in JOIN::exec (this=0xb5e73ae8) at sql_select.cc:2355
#13 0x082352b1 in subselect_single_select_engine::exec (this=0xb5e5e0f8) at item_subselect.cc:2716
#14 0x0822f9e3 in Item_subselect::exec (this=0xb5e5e038) at item_subselect.cc:481
#15 0x082308cd in Item_singlerow_subselect::val_int (this=0xb5e5e038) at item_subselect.cc:918
#16 0x081cf2fc in Item::val_int_result (this=0xb5e5e038) at item.h:779
#17 0x081cb196 in Item_cache_int::cache_value (this=0xb5e882c0) at item.cc:7712
#18 0x081d2f4c in Item_cache_wrapper::cache (this=0xb5e88260) at item.cc:6725
#19 0x081c8812 in Item_cache_wrapper::val_int (this=0xb5e88260) at item.cc:6779
#20 0x081cf2fc in Item::val_int_result (this=0xb5e88260) at item.h:779
#21 0x083c2cbc in make_sortkey (param=0xb6d48c18,
to=0xb5eeb216 "\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245"...,
ref_pos=0xb5ead4a8 "\030\236\300\265\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245h4z\025\355\003") at filesort.cc:852
#22 0x083c2318 in find_all_keys (param=0xb6d48c18, select=0x0, sort_keys=0xb5ee9c08, buffpek_pointers=0xb6d48a50, tempfile=0xb6d48b34, indexfile=0x0)
at filesort.cc:625
#23 0x083c0ed1 in filesort (thd=0xa274fd0, table=0xb5eac240, sortorder=0xb5ecd488, s_length=4, select=0x0, max_rows=18446744073709551615,
sort_positions=false, examined_rows=0xb6d48d80) at filesort.cc:246
#24 0x08324a74 in create_sort_index (thd=0xa274fd0, join=0xb5e69e08, order=0xb5e60e58, filesort_limit=18446744073709551615,
select_limit=18446744073709551615, is_order_by=false) at sql_select.cc:15849
#25 0x08301d02 in JOIN::exec (this=0xb5e69e08) at sql_select.cc:2068
#26 0x08303802 in mysql_select (thd=0xa274fd0, rref_pointer_array=0xa276a44, tables=0xb5e5e840, wild_num=0, fields=..., conds=0xb5e60c40, og_num=12,
order=0xb5e611d0, group=0xb5e60d88, having=0x0, proc_param=0x0, select_options=2147764736, result=0xb5e616f8, unit=0xa2766a8, select_lex=0xa276940)
at sql_select.cc:2556
#27 0x082fbecf in handle_select (thd=0xa274fd0, lex=0xa27664c, result=0xb5e616f8, setup_tables_done_option=0) at sql_select.cc:276
#28 0x0829a5f0 in execute_sqlcom_select (thd=0xa274fd0, all_tables=0xb5e5e840) at sql_parse.cc:5081
#29 0x08290fd0 in mysql_execute_command (thd=0xa274fd0) at sql_parse.cc:2265
#30 0x0829c7d1 in mysql_parse (thd=0xa274fd0,
inBuf=0xb5e31900 "/* cache is on */ SELECT (\nSELECT 4\nFROM DUAL ) AS field1 , SUM( DISTINCT table1 . `pk` ) AS field2 , (\nSELECT MAX( SUBQUERY2_t1 . `col_int_nokey` ) AS SUBQUERY2_field1\nFROM ( C AS SUBQUERY2_t"..., length=1049, found_semicolon=0xb6d4a230) at sql_parse.cc:6027
#31 0x0828ea02 in dispatch_command (command=COM_QUERY, thd=0xa274fd0,
packet=0xa28d329 "/* cache is on */ SELECT (\nSELECT 4\nFROM DUAL ) AS field1 , SUM( DISTINCT table1 . `pk` ) AS field2 , (\nSELECT MAX( SUBQUERY2_t1 . `col_int_nokey` ) AS SUBQUERY2_field1\nFROM ( C AS SUBQUERY2_t"..., packet_length=1050) at sql_parse.cc:1184
#32 0x0828dea8 in do_command (thd=0xa274fd0) at sql_parse.cc:890
#33 0x0828b008 in handle_one_connection (arg=0xa274fd0) at sql_connect.cc:1153
#34 0x00a08919 in start_thread () from /lib/libpthread.so.0
#35 0x00951e5e in clone () from /lib/libc.so.6
Test case:
--disable_warnings
DROP TABLE /*! IF EXISTS */ CC;
DROP TABLE /*! IF EXISTS */ C;
--enable_warnings
CREATE TABLE `CC` ( varchar_ nokey` varchar(1) DEFAULT NULL, key`,`col_ int_key` ) '01:27: 35','v' ,'v'); '19:48: 31','r' ,'r'); '00:00: 00','a' ,'a'); '19:53: 05','m' ,'m'); '19:18: 56','y' ,'y'); 2,'10:55: 12','j' ,'j'); '00:25: 00','d' ,'d'); 0,'12:35: 47','z' ,'z'); '19:53: 03','e' ,'e'); '17:53: 30','h' ,'h'); '11:35: 49','b' ,'b'); NULL,'s' ,'s'); 5,'06:01: 40','e' ,'e'); '05:45: 11','j' ,'j'); '00:00: 00','e' ,'e'); 51,'00: 00:00', 'f','f' ); '06:11: 01','v' ,'v'); '13:02: 46','x' ,'x'); '21:44: 25','m' ,'m'); 4,'22:43: 58','c' ,'c'); varchar_ nokey` varchar(1) DEFAULT NULL, key`,`col_ int_key` ) 2,'11:28: 45','w' ,'w'); '20:25: 14','m' ,'m'); '13:47: 24','m' ,'m'); '19:24: 11','k' ,'k'); '15:59: 13','r' ,'r'); '00:00: 00','t' ,'t'); '15:15: 04','j' ,'j'); '11:32: 06','u' ,'u'); 8,'18:32: 33','h' ,'h'); '15:19: 25','o' ,'o'); 0,'19:03: 19',NULL, NULL); '00:39: 46','k' ,'k'); 166,NULL, 'e','e' ); '00:00: 00','n' ,'n'); '13:12: 11','t' ,'t'); '04:56: 48','c' ,'c'); '19:56: 05','m' ,'m'); '19:35: 19','y' ,'y'); 6,'05:03: 03','f' ,'f'); '18:38: 59','d' ,'d');
`pk` int(11) NOT NULL AUTO_INCREMENT,
`col_int_nokey` int(11) DEFAULT NULL,
`col_int_key` int(11) DEFAULT NULL,
`col_time_key` time DEFAULT NULL,
`col_varchar_key` varchar(1) DEFAULT NULL,
`col_
PRIMARY KEY (`pk`),
KEY `col_int_key` (`col_int_key`),
KEY `col_time_key` (`col_time_key`),
KEY `col_varchar_key` (`col_varchar_
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
INSERT INTO `CC` VALUES (10,7,8,
INSERT INTO `CC` VALUES (11,1,9,
INSERT INTO `CC` VALUES (12,5,9,
INSERT INTO `CC` VALUES (13,3,186,
INSERT INTO `CC` VALUES (14,6,NULL,
INSERT INTO `CC` VALUES (15,92,
INSERT INTO `CC` VALUES (16,7,3,
INSERT INTO `CC` VALUES (17,NULL,
INSERT INTO `CC` VALUES (18,3,133,
INSERT INTO `CC` VALUES (19,5,1,
INSERT INTO `CC` VALUES (20,1,8,
INSERT INTO `CC` VALUES (21,2,5,
INSERT INTO `CC` VALUES (22,NULL,
INSERT INTO `CC` VALUES (23,1,8,
INSERT INTO `CC` VALUES (24,0,6,
INSERT INTO `CC` VALUES (25,210,
INSERT INTO `CC` VALUES (26,8,4,
INSERT INTO `CC` VALUES (27,7,7,
INSERT INTO `CC` VALUES (28,5,6,
INSERT INTO `CC` VALUES (29,NULL,
CREATE TABLE `C` (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`col_int_nokey` int(11) DEFAULT NULL,
`col_int_key` int(11) DEFAULT NULL,
`col_time_key` time DEFAULT NULL,
`col_varchar_key` varchar(1) DEFAULT NULL,
`col_
PRIMARY KEY (`pk`),
KEY `col_int_key` (`col_int_key`),
KEY `col_time_key` (`col_time_key`),
KEY `col_varchar_key` (`col_varchar_
) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
INSERT INTO `C` VALUES (1,NULL,
INSERT INTO `C` VALUES (2,7,9,
INSERT INTO `C` VALUES (3,9,3,
INSERT INTO `C` VALUES (4,7,9,
INSERT INTO `C` VALUES (5,4,NULL,
INSERT INTO `C` VALUES (6,2,9,
INSERT INTO `C` VALUES (7,6,3,
INSERT INTO `C` VALUES (8,8,8,
INSERT INTO `C` VALUES (9,NULL,
INSERT INTO `C` VALUES (10,5,53,
INSERT INTO `C` VALUES (11,NULL,
INSERT INTO `C` VALUES (12,6,5,
INSERT INTO `C` VALUES (13,188,
INSERT INTO `C` VALUES (14,2,3,
INSERT INTO `C` VALUES (15,1,0,
INSERT INTO `C` VALUES (16,1,1,
INSERT INTO `C` VALUES (17,0,9,
INSERT INTO `C` VALUES (18,9,5,
INSERT INTO `C` VALUES (19,NULL,
INSERT INTO `C` VALUES (20,4,2,
set ...