Crash in create_ref_for_key with semijoin + materialization
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| MariaDB |
Fix Released
|
High
|
Sergey Petrunia | ||
Bug Description
#5 0x0832c786 in create_ref_for_key (join=0xae63add8, j=0xae645994, org_keyuse=
#6 0x0832c029 in get_best_
#7 0x0832448c in make_join_
#8 0x0831c038 in JOIN::optimize (this=0xae63add8) at sql_select.cc:1112
#9 0x081b67f2 in st_select_
#10 0x083e4a35 in JOIN::optimize_
#11 0x0831dc0a in JOIN::optimize (this=0xae635b50) at sql_select.cc:1621
#12 0x08321e11 in mysql_select (thd=0xb3346e0, rref_pointer_
group=0x0, having=0x0, proc_param=0x0, select_
#13 0x08319c67 in handle_select (thd=0xb3346e0, lex=0xb335de4, result=0xae632020, setup_tables_
#14 0x082b4434 in execute_
#15 0x082ab1f1 in mysql_execute_
#16 0x082b6a63 in mysql_parse (thd=0xb3346e0,
rawbuf=
length=112, found_semicolon
#17 0x082a8e40 in dispatch_command (command=COM_QUERY, thd=0xb3346e0,
packet=
packet_
#18 0x082a829b in do_command (thd=0xb3346e0) at sql_parse.cc:916
#19 0x082a527f in handle_
#20 0x00821919 in start_thread () from /lib/libpthread
#21 0x0076acce in clone () from /lib/libc.so.6
minimal switch: semijoin=
full switch: index_merge=
EXPLAIN crashes
test case:
CREATE TABLE t1 ( f1 int ) ;
CREATE TABLE t2 ( f5 varchar(52) NOT NULL ) ;
CREATE TABLE t3 ( f1 varchar(3), f4 varchar(52) , KEY (f4), PRIMARY KEY (f1)) ;
CREATE TABLE t4 ( f3 int, KEY (f3));
INSERT INTO t4 VALUES (17),(20);
CREATE TABLE t5 ( f2 int);
INSERT INTO t5 VALUES (0),(0);
SET SESSION optimizer_
SELECT *
FROM t1
JOIN t2
ON ( t2.f5 ) IN (
SELECT t3.f4
FROM t3
WHERE ( 1 ) IN (
)
);
revision-id: <email address hidden>
date: 2011-09-26 23:54:00 +0300
build-date: 2011-09-27 16:15:50 +0300
revno: 3196
branch-nick: maria-5.3
| Changed in maria: | |
| milestone: | none → 5.3 |
| assignee: | nobody → Sergey Petrunia (sergefp) |
| Changed in maria: | |
| importance: | Undecided → High |
| Changed in maria: | |
| status: | New → Confirmed |
| status: | Confirmed → Fix Committed |
| Changed in maria: | |
| status: | Fix Committed → Fix Released |

The crash happens because create_ ref_for_ key() is invoked with a keyuse that does not match the table:
Breakpoint 17, create_ref_for_key (join=0xb29d690, j=0xb2a8db4, org_keyuse= 0xb2abf70, used_tables= 461168601842738 7907) at sql_select.cc:7264 >alias- >Ptr >table- >alias- >Ptr
(gdb) p j->table-
$170 = 0xb291230 "t4"
(gdb) p org_keyuse-
$171 = 0xb28ce58 "t3"