Commit 96cb428b authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-14862: Server crashes in Bitmap<64u>::merge / add_key_field

Do not unwrap view references to keep table info.
(Row-IN subselect does not unwrap items so it does not need fix)
parent d6638586
......@@ -29,3 +29,13 @@ CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t4`.`c1` AS `c1`,`t4`.`c2` AS `c
UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON vw.c2 = del.c2 SET a.c2 = ( SELECT max(t.c1) FROM t3 t, v1 i WHERE del.c2 = t.c2 AND vw.c3 = i.c3 AND t.c3 = 4 ) WHERE a.c2 IS NULL OR a.c2 < '2011-05-01';
drop view v1;
drop table t1,t2,t3,t4;
#
# MDEV-14862: Server crashes in Bitmap<64u>::merge / add_key_field
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (b INT) ENGINE=InnoDB;
DELETE FROM v1 WHERE a IN ( SELECT a FROM t2 );
DELETE FROM v1 WHERE (a,a) IN ( SELECT a,a FROM t2 );
drop view v1;
drop table t1,t2;
......@@ -37,3 +37,16 @@ UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON v
drop view v1;
drop table t1,t2,t3,t4;
--echo #
--echo # MDEV-14862: Server crashes in Bitmap<64u>::merge / add_key_field
--echo #
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (b INT) ENGINE=InnoDB;
DELETE FROM v1 WHERE a IN ( SELECT a FROM t2 );
DELETE FROM v1 WHERE (a,a) IN ( SELECT a,a FROM t2 );
drop view v1;
drop table t1,t2;
......@@ -2070,7 +2070,10 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
}
else
{
Item *item= (Item*) select_lex->item_list.head()->real_item();
Item *item= (Item*) select_lex->item_list.head();
if (item->type() != REF_ITEM ||
((Item_ref*)item)->ref_type() != Item_ref::VIEW_REF)
item= item->real_item();
if (select_lex->table_list.elements)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment