[Commits] aee3d162d23: MDEV-16730: Server crashes in Bitmap<64u>::merge
revision-id: aee3d162d236412bd1b8146f62dca299ccd71017 (mariadb-10.3.6-57-gaee3d162d23) parent(s): 2a3d3e052f63cca4548c5bf8ef48040ecc39c5cf author: Galina Shalygina committer: Galina Shalygina timestamp: 2018-07-29 14:40:58 +0200 message: MDEV-16730: Server crashes in Bitmap<64u>::merge The problem appears because of the pushdown of a non-pushable condition 'cond' into the materialized derived table/view. To prevent pushdown a map of tables that are used in 'cond' should be updated. This call is missing because of the MDEV-12387 changes. The call is added in the setup_jtbm_semi_joins() method. --- mysql-test/main/in_subq_cond_pushdown.result | 17 +++++++++++++++++ mysql-test/main/in_subq_cond_pushdown.test | 19 +++++++++++++++++++ sql/opt_subselect.cc | 1 + 3 files changed, 37 insertions(+) diff --git a/mysql-test/main/in_subq_cond_pushdown.result b/mysql-test/main/in_subq_cond_pushdown.result index 06b7de7a5ac..4ad4180ff52 100644 --- a/mysql-test/main/in_subq_cond_pushdown.result +++ b/mysql-test/main/in_subq_cond_pushdown.result @@ -3814,3 +3814,20 @@ FROM t2 WHERE t2.b IN (SELECT MIN(t1.a) from t1); b DROP TABLE t1, t2; +# +# MDEV-16730: server fault caused by pushdown into the derived table +# condition that joins IN subquery and parent select +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2), (3); +SELECT * +FROM (SELECT DISTINCT * FROM t1) AS tbl +WHERE tbl.a IN +( +SELECT COUNT(t1.a) +FROM t1 +WHERE (t1.a!=1) +); +a +2 +DROP TABLE t1; diff --git a/mysql-test/main/in_subq_cond_pushdown.test b/mysql-test/main/in_subq_cond_pushdown.test index fe317c3bf94..8f911ea2f19 100644 --- a/mysql-test/main/in_subq_cond_pushdown.test +++ b/mysql-test/main/in_subq_cond_pushdown.test @@ -773,3 +773,22 @@ FROM t2 WHERE t2.b IN (SELECT MIN(t1.a) from t1); DROP TABLE t1, t2; + +--echo # +--echo # MDEV-16730: server fault caused by pushdown into the derived table +--echo # condition that joins IN subquery and parent select +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2), (3); + +SELECT * +FROM (SELECT DISTINCT * FROM t1) AS tbl +WHERE tbl.a IN +( + SELECT COUNT(t1.a) + FROM t1 + WHERE (t1.a!=1) +); + +DROP TABLE t1; diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index de8cf1e54a1..1b3e2973133 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -5924,6 +5924,7 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list, Item *item; while ((item=li++)) { + item->update_used_tables(); if (eq_list.push_back(item, thd->mem_root)) DBUG_RETURN(TRUE); }
participants (1)
-
Galina