RQG: Crash in fix_semijoin_strategies_for_picked_join_order()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Invalid
|
High
|
Sergey Petrunia |
Bug Description
Queries of the following form cause a crash in maria 5.3 and not on 5.2 or lp:mysql. The correct response instead seems to be "1242: Subquery returns more than 1 row"
SELECT `col_int_key` FROM C
WHERE (
SELECT `col_varchar_nokey`
FROM CC SUBQUERY1_t1
WHERE `col_varchar_key` = ANY (
SELECT CHILD_SUBQUERY1_t1 .`col_varchar_key`
FROM CC CHILD_SUBQUERY1_t1
LEFT JOIN A ON CHILD_SUBQUERY1_t1 .`pk`
WHERE SUBQUERY1_t1 .`col_int_nokey`
)
)
bzr version-info:
[philips@eve mysql-test]$ bzr version-info
revision-id: <email address hidden>
date: 2010-06-14 15:17:54 +0400
build-date: 2010-07-02 02:40:41 -0700
revno: 2789
branch-nick: maria
backtrace:
#3 0x082776c0 in handle_segfault (sig=11) at mysqld.cc:2683
#4 <signal handler called>
#5 0x083ad313 in fix_semijoin_
#6 0x08304e2f in get_best_
#7 0x082fdf92 in make_join_
#8 0x082f654b in JOIN::optimize (this=0xadacc58) at sql_select.cc:921
#9 0x0822dbe4 in subselect_
#10 0x08228a27 in Item_subselect:
#11 0x0822976f in Item_singlerow_
#12 0x081d93c7 in eval_const_cond (cond=0xace2910) at item_func.cc:63
#13 0x0830f231 in remove_eq_conds (thd=0xab881a0, cond=0xace2910, cond_value=
#14 0x0830ec20 in optimize_cond (join=0xada7de8, conds=0xace2910, join_list=
#15 0x082f5e56 in JOIN::optimize (this=0xada7de8) at sql_select.cc:784
#16 0x082fb8fa in mysql_select (thd=0xab881a0, rref_pointer_
group=0x0, having=0x0, proc_param=0x0, select_
#17 0x082f4803 in handle_select (thd=0xab881a0, lex=0xab897b4, result=0xace2a60, setup_tables_
#18 0x0829466d in execute_
#19 0x0828b069 in mysql_execute_
#20 0x08296857 in mysql_parse (thd=0xab881a0,
inBuf=0xace0cc8 "SELECT `col_int_key`\nFROM C\nWHERE (\nSELECT `col_varchar_
#21 0x08288b11 in dispatch_command (command=COM_QUERY, thd=0xab881a0,
packet=
#22 0x08287d4f in do_command (thd=0xab881a0) at sql_parse.cc:891
#23 0x08284e96 in handle_
#24 0x00a08919 in start_thread () from /lib/libpthread
#25 0x00951e5e in clone () from /lib/libc.so.6
code:
(gdb) list
2039 POSITION *pos= join->best_
2040 JOIN_TAB *s= pos->table;
2041 uint first;
2042 LINT_INIT(first); // Set by every branch except SJ_OPT_NONE which doesn't use it
2043
2044 if ((handled_tabs & s->table->map) || pos->sj_strategy == SJ_OPT_NONE)
2045 {
2046 remaining_tables |= s->table->map;
2047 continue;
2048 }
(gdb) print s
$1 = (JOIN_TAB *) 0xa5a5a5a5
summary: |
- fix_semijoin_strategies_for_picked_join_order + RQG: Crash in fix_semijoin_strategies_for_picked_join_order() |
Changed in maria: | |
milestone: | none → 5.3 |
Changed in maria: | |
assignee: | nobody → Sergey Petrunia (sergefp) |
Changed in maria: | |
importance: | Undecided → High |
Test case:
--disable_warnings
DROP TABLE /*! IF EXISTS */ A;
DROP TABLE /*! IF EXISTS */ CC;
DROP TABLE /*! IF EXISTS */ C;
--enable_warnings
CREATE TABLE `A` ( varchar_ nokey` varchar(1) DEFAULT NULL, key`,`col_ int_key` ) varchar_ nokey` varchar(1) DEFAULT NULL, key`,`col_ int_key` ) 'y','y' ); 0,'z',' z'); 5,'e',' e'); 51,'f', 'f'); 4,'c',' c'); varchar_ nokey` varchar(1) DEFAULT NULL, key`,`col_ int_key` ) 0,NULL, NULL); 166,'e' ,'e'); 6,'f',' f');
`pk` int(11) NOT NULL AUTO_INCREMENT,
`col_int_nokey` int(11) DEFAULT NULL,
`col_int_key` int(11) DEFAULT NULL,
`col_varchar_key` varchar(1) DEFAULT NULL,
`col_
PRIMARY KEY (`pk`),
KEY `col_int_key` (`col_int_key`),
KEY `col_varchar_key` (`col_varchar_
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `CC` (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`col_int_nokey` int(11) DEFAULT NULL,
`col_int_key` int(11) DEFAULT NULL,
`col_varchar_key` varchar(1) DEFAULT NULL,
`col_
PRIMARY KEY (`pk`),
KEY `col_int_key` (`col_int_key`),
KEY `col_varchar_key` (`col_varchar_
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
INSERT INTO `CC` VALUES (10,7,8,'v','v');
INSERT INTO `CC` VALUES (11,1,9,'r','r');
INSERT INTO `CC` VALUES (12,5,9,'a','a');
INSERT INTO `CC` VALUES (13,3,186,'m','m');
INSERT INTO `CC` VALUES (14,6,NULL,
INSERT INTO `CC` VALUES (15,92,2,'j','j');
INSERT INTO `CC` VALUES (16,7,3,'d','d');
INSERT INTO `CC` VALUES (17,NULL,
INSERT INTO `CC` VALUES (18,3,133,'e','e');
INSERT INTO `CC` VALUES (19,5,1,'h','h');
INSERT INTO `CC` VALUES (20,1,8,'b','b');
INSERT INTO `CC` VALUES (21,2,5,'s','s');
INSERT INTO `CC` VALUES (22,NULL,
INSERT INTO `CC` VALUES (23,1,8,'j','j');
INSERT INTO `CC` VALUES (24,0,6,'e','e');
INSERT INTO `CC` VALUES (25,210,
INSERT INTO `CC` VALUES (26,8,4,'v','v');
INSERT INTO `CC` VALUES (27,7,7,'x','x');
INSERT INTO `CC` VALUES (28,5,6,'m','m');
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_varchar_key` varchar(1) DEFAULT NULL,
`col_
PRIMARY KEY (`pk`),
KEY `col_int_key` (`col_int_key`),
KEY `col_varchar_key` (`col_varchar_
) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
INSERT INTO `C` VALUES (1,NULL,2,'w','w');
INSERT INTO `C` VALUES (2,7,9,'m','m');
INSERT INTO `C` VALUES (3,9,3,'m','m');
INSERT INTO `C` VALUES (4,7,9,'k','k');
INSERT INTO `C` VALUES (5,4,NULL,'r','r');
INSERT INTO `C` VALUES (6,2,9,'t','t');
INSERT INTO `C` VALUES (7,6,3,'j','j');
INSERT INTO `C` VALUES (8,8,8,'u','u');
INSERT INTO `C` VALUES (9,NULL,8,'h','h');
INSERT INTO `C` VALUES (10,5,53,'o','o');
INSERT INTO `C` VALUES (11,NULL,
INSERT INTO `C` VALUES (12,6,5,'k','k');
INSERT INTO `C` VALUES (13,188,
INSERT INTO `C` VALUES (14,2,3,'n','n');
INSERT INTO `C` VALUES (15,1,0,'t','t');
INSERT INTO `C` VALUES (16,1,1,'c','c');
INSERT INTO `C` VALUES (17,0,9,'m','m');
INSERT INTO `C` VALUES (18,9,5,'y','y');
INSERT INTO `C` VALUES (19,NULL,
INSERT INTO `C` VALUES (20,4,2,'d','d');
SELECT `col_int_key`
FROM C
WHERE (
SELECT `col_varchar_nokey`
FROM CC SUBQUERY1_t1
WHERE `col_varchar_key` = ANY (
SELECT CHILD_SUBQUERY1_t1 .`col_varchar_key`
FR...