summaryrefslogtreecommitdiff
path: root/mysql-test/t/derived.test
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2015-08-31 18:40:24 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2015-08-31 18:40:24 +0200
commit4b41e3c7f33714186c97a6cc2e6d3bb93b050c61 (patch)
treefdc312b7d2f3ed8f12af293f8f724c5148d91227 /mysql-test/t/derived.test
parentb66455f67da9b0bbe7fb7862c23a8283d766e149 (diff)
downloadmariadb-git-4b41e3c7f33714186c97a6cc2e6d3bb93b050c61.tar.gz
MDEV-6219: Server crashes in Bitmap<64u>::merge (this=0x180, map2=...) on 2nd execution of PS with INSERT .. SELECT, derived_merge
Problem: Not all permanent Item_direct_view_ref was in permanent list of used items of the view. Solution: Detect creating permenent view/derived table reference and put them in the permanent list at once.
Diffstat (limited to 'mysql-test/t/derived.test')
-rw-r--r--mysql-test/t/derived.test35
1 files changed, 34 insertions, 1 deletions
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index ddce7f55292..d98e7b56905 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -492,7 +492,38 @@ update t1 set balance=(select sum(balance) from (SELECT balance FROM t1 where ac
set optimizer_switch=@save_derived_optimizer_switch_bug;
drop table t1;
-set optimizer_switch=@save_derived_optimizer_switch;
+--echo #
+--echo # MDEV-6219:Server crashes in Bitmap<64u>::merge
+--echo # (this=0x180, map2=...) on 2nd execution of PS with INSERT .. SELECT,
+--echo # derived_merge
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('bar');
+
+create procedure p1()
+ INSERT INTO t1 SELECT * FROM (
+ SELECT * FROM t1
+ ) AS sq
+ WHERE sq.a IN ( SELECT 'baz' FROM DUAL );
+
+call p1();
+call p1();
+drop procedure p1;
+
+PREPARE stmt FROM "
+ INSERT INTO t1 SELECT * FROM (
+ SELECT * FROM t1
+ ) AS sq
+ WHERE sq.a IN ( SELECT 'baz' FROM DUAL )
+";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+deallocate prepare stmt;
+
+drop table t1;
--echo #
--echo # MDEV-6892: WHERE does not apply
@@ -506,3 +537,5 @@ select x.id, message from (select id from t1) x left join
(select id, 1 as message from t2) y on x.id=y.id
where coalesce(message,0) <> 0;
drop table t1,t2;
+
+set optimizer_switch=@save_derived_optimizer_switch;