Assertion `inited==INDEX' failed in handler::ha_index_end on trigger executing INSERT .. SELECT with FROM subquery, view, derived_with_keys=on
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Igor Babaev |
Bug Description
mysqld: handler.h:1716: int handler:
#8 0xb74d8014 in __assert_fail () from /lib/libc.so.6
#9 0x081ec79e in handler:
#10 0x0827f0ce in subselect_
at item_subselect.
#11 0x082786dc in Item_subselect:
at item_subselect.
#12 0x082788df in Item_in_
at item_subselect.
#13 0x082df9bc in cleanup_items (item=0x9472c40) at sql_parse.cc:654
#14 0x084cca9c in sp_head::execute (this=0x9470480, thd=0x93f1110)
at sp_head.cc:1286
#15 0x084cd401 in sp_head:
db_
at sp_head.cc:1586
#16 0x084e044c in Table_triggers_
thd=0x93f1110, event=TRG_
old_
#17 0x0833f7a9 in fill_record_
ptr=0x946eca8, values=..., ignore_
event=
#18 0x0838a181 in mysql_insert (thd=0x93f1110, table_list=
fields=..., values_list=..., update_fields=..., update_values=...,
duplic=
#19 0x082e5bf8 in mysql_execute_
#20 0x082ee4d4 in mysql_parse (thd=0x93f1110,
rawbuf=
found_
#21 0x082e0eb5 in dispatch_command (command=COM_QUERY, thd=0x93f1110,
packet=
at sql_parse.cc:1228
#22 0x082e035f in do_command (thd=0x93f1110) at sql_parse.cc:923
#23 0x082dd2e5 in handle_
at sql_connect.cc:1193
#24 0xb7766b25 in start_thread () from /lib/libpthread
bzr version-info
revision-id: <email address hidden>
date: 2012-04-03 15:42:26 +0300
build-date: 2012-04-04 02:44:16 +0400
revno: 3489
Notes:
Could not reproduce on MariaDB 5.2, MariaDB 5.5, MySQL 5.5, MySQL trunk.
Could not reproduce running the same query without a trigger.
Could not reproduce replacing the view with a table.
Minimal optimizer_switch: derived_
Full optimizer_switch (standard): index_merge=
EXPLAINs for the SELECT extracted from the trigger (not sure it's relevant since the standalone SELECT does not cause the failure):
With the standard optimizer switch:
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00Using where; Using join buffer (flat, BNL join)
3 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2100.00
4 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t1` where (((`test`.`t1`.`a` = 3) or (`test`.`t1`.`a` > 5)) and <in_optimizer>
With the minimal optimizer_switch (derived_
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00Using where; Using join buffer (flat, BNL join)
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00Using where
3 DEPENDENT SUBQUERY <derived4> index_subquery key0 key0 5func 2 100.00
4 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <in_optimizer>
Test case:
SET optimizer_switch = 'derived_
CREATE TABLE t1 ( a INT, b INT );
INSERT INTO t1 VALUES (1,0),(2,8);
CREATE ALGORITHM=TEMPTABLE VIEW v1
AS SELECT * FROM t1;
CREATE TABLE t2 ( c INT );
CREATE TABLE t3 ( d INT, e INT );
CREATE TRIGGER tr BEFORE INSERT ON t2 FOR EACH ROW
INSERT INTO t3
SELECT t1.* FROM (
SELECT * FROM t1
WHERE b IN ( SELECT b FROM v1 )
) AS alias1,
t1
WHERE t1.a = 3 OR t1.a > 5;
INSERT INTO t2 VALUES (1);
Changed in maria: | |
status: | New → Confirmed |
assignee: | Oleksandr "Sanja" Byelkin (sanja-byelkin) → Igor Babaev (igorb-seattle) |
status: | Confirmed → In Progress |
Changed in maria: | |
status: | In Progress → Fix Committed |
Set to 'High' rather than 'Critical' because I didn't get any visible problems on release (as non-debug) binaries.