diff options
author | Galina Shalygina <galina.shalygina@mariadb.com> | 2019-04-05 22:55:20 +0300 |
---|---|---|
committer | Galina Shalygina <galina.shalygina@mariadb.com> | 2019-04-05 22:55:20 +0300 |
commit | 694d1a50bd7754c5357dde184f87d63b7032ee5e (patch) | |
tree | 1c2c2935b2aabeceb6a37c6bcb4d7920aeab5169 /mysql-test/main/having_cond_pushdown.test | |
parent | c84dde148f8d82232a110f9ff7c80df94d0d6c8c (diff) | |
download | mariadb-git-694d1a50bd7754c5357dde184f87d63b7032ee5e.tar.gz |
MDEV-19185: Pushdown constant function defined with subquery
The bug occurs because of the wrong pushdown of constant function
defined with subquery from HAVING into WHERE. Subqueries can't be
pushed into WHERE.
To fix it with_subquery() call is added to check if the function contains
subquery.
Diffstat (limited to 'mysql-test/main/having_cond_pushdown.test')
-rw-r--r-- | mysql-test/main/having_cond_pushdown.test | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/main/having_cond_pushdown.test b/mysql-test/main/having_cond_pushdown.test index 1e5ad610e90..a50fa11484d 100644 --- a/mysql-test/main/having_cond_pushdown.test +++ b/mysql-test/main/having_cond_pushdown.test @@ -1301,3 +1301,20 @@ execute stmt1; deallocate prepare stmt1; DROP TABLE t1,t3; + + +--echo # +--echo # MDEV-19185: pushdown constant function with subquery +--echo # + +CREATE TABLE t1 (pk INT, c1 VARCHAR(64)); +INSERT INTO t1 VALUES (1,'bbb'),(2,'aaa'),(3,'ccc'); +CREATE VIEW v1 AS SELECT * FROM t1; + +SELECT pk +FROM t1 +GROUP BY pk +HAVING (1 NOT IN (SELECT COUNT(t1.c1) FROM (v1, t1))); + +DROP TABLE t1; +DROP VIEW v1; |