diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2012-01-25 18:33:57 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2012-01-25 18:33:57 +0400 |
commit | 73cc529b51dd4262e81df86491e3f2803946339c (patch) | |
tree | 2706fa7435c85b4c80e9161d75876204441a32e3 /sql/sql_select.h | |
parent | e10816118a35cdb67cd9e1e7b671c946741d3f7c (diff) | |
download | mariadb-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/sql_select.h')
-rw-r--r-- | sql/sql_select.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h index 8b448130eaf..185bf90ea17 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -379,6 +379,12 @@ typedef struct st_join_table { /* Buffer to save index tuple to be able to skip duplicates */ uchar *loosescan_buf; + /* + Index used by LooseScan (we store it here separately because ref access + stores it in tab->ref.key, while range scan stores it in tab->index, etc) + */ + uint loosescan_key; + /* Length of key tuple (depends on #keyparts used) to store in the above */ uint loosescan_key_len; |