diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2018-07-11 10:43:38 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2018-07-11 10:43:38 +0300 |
commit | 2fbf2277ffec86d69f793534da7043b6dd540780 (patch) | |
tree | 305c01ff9e68e110a81121f5a9abdabad8d40eea /sql/opt_subselect.cc | |
parent | 24a0a74f5d92a861989fcea17a0c62c1ee7b1299 (diff) | |
download | mariadb-git-2fbf2277ffec86d69f793534da7043b6dd540780.tar.gz |
MDEV-15982: Incorrect results when subquery is materialized
fix_semijoin_strategies_for_picked_join_order() should set
join->sjm_lookup_tables to be a bitmap of tables inside
SJ-Materialization-Lookup nests.
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r-- | sql/opt_subselect.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index ec7b10f20c8..14b2aaee591 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -3532,7 +3532,8 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join) first= tablenr - sjm->tables + 1; join->best_positions[first].n_sj_tables= sjm->tables; join->best_positions[first].sj_strategy= SJ_OPT_MATERIALIZE; - join->sjm_lookup_tables|= s->table->map; + for (uint i= first; i < first+ sjm->tables; i++) + join->sjm_lookup_tables |= join->best_positions[i].table->table->map; } else if (pos->sj_strategy == SJ_OPT_MATERIALIZE_SCAN) { |