diff options
author | Igor Babaev <igor@askmonty.org> | 2019-02-24 02:02:07 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2019-02-24 02:02:07 -0800 |
commit | 25870f48cf66c5984332120d1cb11db79ca1b5f6 (patch) | |
tree | ed38ba3e60266d5cdc4cdd37676154137c7b9cc6 /mysql-test/main | |
parent | 31deef0953a5cf7259e1d064ae7f2e0dde922436 (diff) | |
download | mariadb-git-25870f48cf66c5984332120d1cb11db79ca1b5f6.tar.gz |
MDEV-18668 Server crash or ASAN use-after-poison in Item_equal_iterator /
st_select_lex::pushdown_from_having_into_where upon query
with impossible WHERE condition
Do not push from HAVING into impossible WHERE
Diffstat (limited to 'mysql-test/main')
-rw-r--r-- | mysql-test/main/having_cond_pushdown.result | 12 | ||||
-rw-r--r-- | mysql-test/main/having_cond_pushdown.test | 13 |
2 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result index 9d2fbcead4e..ef7368bd1fb 100644 --- a/mysql-test/main/having_cond_pushdown.result +++ b/mysql-test/main/having_cond_pushdown.result @@ -1906,3 +1906,15 @@ EXPLAIN DROP TABLE t1,t2; DROP VIEW v1; DROP FUNCTION f1; +# +# MDEV-18668: pushdown from HAVING into impossible WHERE +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1),(2,2); +SELECT a FROM t1 WHERE b = 1 AND b = 2 GROUP BY a HAVING a <= 3; +a +EXPLAIN +SELECT a FROM t1 WHERE b = 1 AND b = 2 GROUP BY a HAVING a <= 3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +DROP TABLE t1; diff --git a/mysql-test/main/having_cond_pushdown.test b/mysql-test/main/having_cond_pushdown.test index 2af9d58bc4d..2fbb5708c50 100644 --- a/mysql-test/main/having_cond_pushdown.test +++ b/mysql-test/main/having_cond_pushdown.test @@ -473,3 +473,16 @@ eval $no_pushdown explain format=json $query; DROP TABLE t1,t2; DROP VIEW v1; DROP FUNCTION f1; + +--echo # +--echo # MDEV-18668: pushdown from HAVING into impossible WHERE +--echo # + +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1),(2,2); + +SELECT a FROM t1 WHERE b = 1 AND b = 2 GROUP BY a HAVING a <= 3; +EXPLAIN +SELECT a FROM t1 WHERE b = 1 AND b = 2 GROUP BY a HAVING a <= 3; + +DROP TABLE t1; |