summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/derived_view.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/derived_view.test')
-rw-r--r--mysql-test/main/derived_view.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/main/derived_view.test b/mysql-test/main/derived_view.test
index 03565ae0..ddead30a 100644
--- a/mysql-test/main/derived_view.test
+++ b/mysql-test/main/derived_view.test
@@ -2759,6 +2759,42 @@ deallocate prepare stmt;
drop view v;
drop table t1,t2,t3;
+--echo #
+--echo # MDEV-32829 Crash when executing PS for query with eliminated subquery
+--echo # using view
+--echo #
+
+create view v1 as select 1 as a;
+prepare stmt from
+ 'SELECT EXISTS (SELECT 1 FROM v1 GROUP BY a IN (SELECT a FROM v1))';
+execute stmt;
+drop view v1;
+
+create table t1 (a int, b int);
+insert into t1 values (1,2),(3,4),(5,6);
+create view v1 as select * from t1;
+create table t2 select * from t1;
+
+let $q=
+select t2.a from t2 where exists
+(
+ select * from t1 where t2.b = t1.b and t1.b != 6
+ group by a in (select a from v1 where v1.a = t2.a)
+);
+
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+eval create procedure aproc() $q;
+call aproc();
+call aproc();
+
+drop table t1, t2;
+drop view v1;
+drop procedure aproc;
+
--echo # End of 10.4 tests
--echo #