summaryrefslogtreecommitdiff
path: root/mysql-test/main/derived_cond_pushdown.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2019-02-23 14:53:27 -0800
committerIgor Babaev <igor@askmonty.org>2019-02-26 18:03:39 -0800
commit9bd47835d0fcdcf2f041da39dbe5b98ff738ff10 (patch)
tree91729378e774ccedc9b15da534b7228cdde1db76 /mysql-test/main/derived_cond_pushdown.test
parentbba4e7f28795be278816cb904cb2aaa5901fbb9b (diff)
downloadmariadb-git-9bd47835d0fcdcf2f041da39dbe5b98ff738ff10.tar.gz
MDEV-18679 Server crashes in JOIN::optimize
The bug manifested itself when executing a query with materialized view/derived/CTE whose specification was a SELECT query contained another materialized derived and impossible WHERE/HAVING condition was detected for this SELECT. As soon as such condition is detected the join structures of all derived tables used in the SELECT are destroyed. So optimization of the queries specifying these derived tables is impossible. Besides it's not needed. In 10.3 optimization of a materialized derived table is performed before detection of impossible WHERE/HAVING condition in the embedding SELECT.
Diffstat (limited to 'mysql-test/main/derived_cond_pushdown.test')
-rw-r--r--mysql-test/main/derived_cond_pushdown.test23
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test
index 076d39c1abd..ef28dcf1d97 100644
--- a/mysql-test/main/derived_cond_pushdown.test
+++ b/mysql-test/main/derived_cond_pushdown.test
@@ -3263,3 +3263,26 @@ set join_cache_level=default;
DROP TABLE t1,t2;
--echo # End of 10.3 tests
+
+--echo #
+--echo # MDEV-18679: materialized view with SELECT S containing materialized
+--echo # derived when impossible WHERE has been detected for S
+--echo #
+
+create table t1 (pk int, f varchar(1));
+insert into t1 values
+ (3,'y'), (1,'x'), (7,'z');
+
+create view v1 as
+select t1.f
+ from t1, (select distinct * from t1) t
+ where t.f = t1.f and 1 = 0
+group by t1.f;
+
+select * from v1;
+explain select * from v1;
+
+drop view v1;
+drop table t1;
+
+--echo # End of 10.4 tests