Assertion `0' failed in get_match_flag_by_pos() with semijoin_with_cache=on,derived_with_keys=off, temptable views, join_cache_level=8, innodb
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
Critical
|
Igor Babaev |
Bug Description
This query:
SELECT *
FROM (
SELECT t3.*
FROM t1 JOIN t3 ON
( t3.b = t1.b )
) AS alias1
WHERE c IN (
SELECT v4.b
FROM v4 JOIN t2
);
causes this assertion:
mysqld: sql_join_
#8 0x006b0d98 in __assert_fail () from /lib/libc.so.6
#9 0x082fee73 in JOIN_CACHE:
#10 0x082ff5f9 in JOIN_CACHE:
#11 0x08301615 in JOIN_CACHE_
#12 0x082ffc4b in JOIN_CACHE:
#13 0x082ff74d in JOIN_CACHE:
#14 0x0834a31f in sub_select_cache (join=0x9b232e08, join_tab=
#15 0x0834a537 in sub_select (join=0x9b232e08, join_tab=
#16 0x0834a537 in sub_select (join=0x9b232e08, join_tab=
#17 0x0834a34b in sub_select_cache (join=0x9b232e08, join_tab=
#18 0x0834a537 in sub_select (join=0x9b232e08, join_tab=
#19 0x0834a026 in do_select (join=0x9b232e08, fields=0xa82cf24, table=0x0, procedure=0x0) at sql_select.cc:14819
#20 0x0832e69a in JOIN::exec (this=0x9b232e08) at sql_select.cc:2685
#21 0x0832eec6 in mysql_select (thd=0xa82b450, rref_pointer_
order=0x0, group=0x0, having=0x0, proc_param=0x0, select_
at sql_select.cc:2906
#22 0x08326bf3 in handle_select (thd=0xa82b450, lex=0xa82cb54, result=0xa1c2f0e8, setup_tables_
#23 0x082c12b8 in execute_
#24 0x082b8075 in mysql_execute_
#25 0x082c38f9 in mysql_parse (thd=0xa82b450,
rawbuf=
length=117, found_semicolon
#26 0x082b5cc4 in dispatch_command (command=COM_QUERY, thd=0xa82b450, packet=0xa884109 "", packet_length=117) at sql_parse.cc:1221
#27 0x082b511f in do_command (thd=0xa82b450) at sql_parse.cc:916
#28 0x082b2103 in handle_
#29 0x00821919 in start_thread () from /lib/libpthread
#30 0x0076acce in clone () from /lib/libc.so.6
explain:
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
1 PRIMARY t1 ref b b 4 test.t3.b 1 Using index
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t2); Using join buffer (flat, BNL join)
4 DERIVED t4 ALL NULL NULL NULL NULL 1
minimal switch: semijoin_
full switch: index_merge=
revision-id: <email address hidden>
date: 2011-11-29 15:27:52 +0400
build-date: 2011-11-30 11:12:24 +0200
revno: 3321
branch-nick: maria-5.3
test case:
--source include/
SET SESSION join_cache_level = 8;
SET SESSION optimizer_switch = 'semijoin_
SET SESSION optimizer_switch = 'derived_
CREATE TABLE t1 (a int, b varchar(1), KEY (b,a));
INSERT INTO t1 VALUES (0,'x'),(5,'r');
CREATE TABLE t2 (a int) ENGINE=InnoDB;
INSERT INTO t2 VALUES (8);
CREATE TABLE t3 (b varchar(1), c varchar(1)) ENGINE=InnoDB;
INSERT INTO t3 VALUES ('x','x');
CREATE TABLE t4 (a int NOT NULL, b varchar(1)) ENGINE=InnoDB;
INSERT INTO t4 VALUES (20,'r');
CREATE ALGORITHM=TEMPTABLE VIEW v4 AS SELECT * FROM t4;
SELECT *
FROM (
SELECT t3.*
FROM t1 JOIN t3 ON
( t3.b = t1.b )
) AS alias1
WHERE c IN (
SELECT v4.b
FROM v4 JOIN t2
);
Changed in maria: | |
milestone: | none → 5.3 |
Changed in maria: | |
status: | New → Confirmed |
importance: | Undecided → Critical |
assignee: | nobody → Igor Babaev (igorb-seattle) |
Changed in maria: | |
status: | Confirmed → In Progress |
Changed in maria: | |
status: | In Progress → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
The bug can be reproduced without any views.