summaryrefslogtreecommitdiff
path: root/sql/opt_subselect.cc
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2018-07-11 10:43:38 +0300
committerSergei Petrunia <psergey@askmonty.org>2018-07-11 10:43:38 +0300
commit2fbf2277ffec86d69f793534da7043b6dd540780 (patch)
tree305c01ff9e68e110a81121f5a9abdabad8d40eea /sql/opt_subselect.cc
parent24a0a74f5d92a861989fcea17a0c62c1ee7b1299 (diff)
downloadmariadb-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.cc3
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)
{