summaryrefslogtreecommitdiff
path: root/mysql-test/t/derived_cond_pushdown.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-06-29 20:50:07 -0700
committerIgor Babaev <igor@askmonty.org>2017-06-29 20:50:26 -0700
commit9f0c1c0cf6a24a8613b3327c6f52a7d954e0e18b (patch)
tree30216680eca4a9c47dda7b9a1096b1d6a79d1000 /mysql-test/t/derived_cond_pushdown.test
parent84e4e4506ffee95d71f1cac916176e9b64ba1bd8 (diff)
downloadmariadb-git-9f0c1c0cf6a24a8613b3327c6f52a7d954e0e18b.tar.gz
Fixed the bug mdev-13193.
When an equality that can be pushed into a materialized derived table / view is extracted from multiple equalities and their operands are cloned then if they have some pointers to Item_equal objects those pointers must be set to NULL in the clones. Anyway they are not valid in the pushed predicates.
Diffstat (limited to 'mysql-test/t/derived_cond_pushdown.test')
-rw-r--r--mysql-test/t/derived_cond_pushdown.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test
index beeaa7350f7..de8a479614e 100644
--- a/mysql-test/t/derived_cond_pushdown.test
+++ b/mysql-test/t/derived_cond_pushdown.test
@@ -1526,3 +1526,25 @@ eval explain format=json $q;
DROP VIEW v1;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-13193: pushdown of equality extracted from multiple equality
+--echo #
+
+CREATE TABLE t1 (i1 int, KEY(i1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (2),(4);
+
+CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
+
+let $q=
+SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq
+ WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 );
+
+eval $q;
+eval explain format=json $q;
+
+DROP VIEW v2;
+DROP TABLE t1,t2;