Crash in make_join_select on second execution of prepared statement with view
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
Critical
|
Oleksandr "Sanja" Byelkin |
Bug Description
Repeatable in maria-5.2, maria-5.3. Not repeatable in mysql-5.5 . The following query:
SELECT t1.f6 FROM t1 RIGHT JOIN v2 ON v2.f3 WHERE t1.f1 != 0
crashes on its second execution as a prepared statement. This particular example uses an ON condition that is not a boolean expression, but the bug has also been observed with a realistic ON condition.
backtrace:
#3 0x08289e44 in handle_segfault (sig=11) at mysqld.cc:2774
#4 <signal handler called>
#5 0x0831aee5 in make_join_select (join=0xae535b40, select=0xae513b40, cond=0xae512fb0) at sql_select.cc:7179
#6 0x0830ae14 in JOIN::optimize (this=0xae535b40) at sql_select.cc:1130
#7 0x0830fd2d in mysql_select (thd=0x9a04da8, rref_pointer_
order=0x0, group=0x0, having=0x0, proc_param=0x0, select_
at sql_select.cc:2687
#8 0x0830860f in handle_select (thd=0x9a04da8, lex=0xae52a1c8, result=0xae52b648, setup_tables_
#9 0x082a5954 in execute_
#10 0x0829c79e in mysql_execute_
#11 0x0834f168 in Prepared_
#12 0x0834e650 in Prepared_
at sql_prepare.cc:3352
#13 0x0834cf6c in mysql_sql_
#14 0x0829c7c7 in mysql_execute_
#15 0x082a7ef7 in mysql_parse (thd=0x9a04da8, rawbuf=0xae512eb0 "EXECUTE prep_stmt", length=17, found_semicolon
#16 0x0829a427 in dispatch_command (command=COM_QUERY, thd=0x9a04da8, packet=0x9a5f901 "EXECUTE prep_stmt", packet_length=17) at sql_parse.cc:1215
#17 0x08299885 in do_command (thd=0x9a04da8) at sql_parse.cc:904
#18 0x08296938 in handle_
#19 0x00821919 in start_thread () from /lib/libpthread
#20 0x0076acce in clone () from /lib/libc.so.6
test case:
CREATE TABLE t1 ( f1 int NOT NULL , f6 int NOT NULL ) ;
INSERT IGNORE INTO t1 VALUES (20, 2);
CREATE TABLE t2 ( f3 int NOT NULL ) ;
INSERT IGNORE INTO t2 VALUES (7);
CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2;
PREPARE prep_stmt FROM 'SELECT t1.f6 FROM t1 RIGHT JOIN v2 ON v2.f3 WHERE t1.f1 != 0';
EXECUTE prep_stmt;
EXECUTE prep_stmt;
Changed in maria: | |
milestone: | none → 5.2 |
Changed in maria: | |
assignee: | nobody → Sergey Petrunia (sergefp) |
Changed in maria: | |
status: | New → Confirmed |
importance: | Undecided → Critical |
Changed in maria: | |
assignee: | Sergey Petrunia (sergefp) → Oleksandr "Sanja" Byelkin (sanja-byelkin) |
Changed in maria: | |
status: | Confirmed → In Progress |
Changed in maria: | |
milestone: | 5.2 → 5.1 |
status: | In Progress → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
status: | Fix Released → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
Not repeatable with: mysql 5.1, mysql 5.5
Repeatable with: maria-5.1, maria-5.2, maria-5.3