summaryrefslogtreecommitdiff
path: root/sql/opt_subselect.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2012-01-25 18:33:57 +0400
committerSergey Petrunya <psergey@askmonty.org>2012-01-25 18:33:57 +0400
commit73cc529b51dd4262e81df86491e3f2803946339c (patch)
tree2706fa7435c85b4c80e9161d75876204441a32e3 /sql/opt_subselect.cc
parente10816118a35cdb67cd9e1e7b671c946741d3f7c (diff)
downloadmariadb-git-73cc529b51dd4262e81df86491e3f2803946339c.tar.gz
BUG#920255: Wrong result (extra rows) with loosescan and IN subquery
The problem was that LooseScan execution code assumed that tab->key holds the index used for looseScan. This is only true when range or full index scan are used. In case of ref access, the index is in tab->ref.key (and tab->index==0 which explains how LooseScan passed tests with ref access: they used one index) Fixed by setting/using loosescan_key, which always the correct index#.
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r--sql/opt_subselect.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 8e043b17bcf..63a90891720 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -4107,6 +4107,7 @@ int setup_semijoin_dups_elimination(JOIN *join, ulonglong options,
for (uint kp=0; kp < pos->loosescan_picker.loosescan_parts; kp++)
keylen += tab->table->key_info[keyno].key_part[kp].store_length;
+ tab->loosescan_key= keyno;
tab->loosescan_key_len= keylen;
if (pos->n_sj_tables > 1)
tab[pos->n_sj_tables - 1].do_firstmatch= tab;