mirror of
https://github.com/MariaDB/server.git
synced 2025-07-10 04:22:00 +03:00
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#.
This commit is contained in:
@ -15372,7 +15372,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
|
||||
if (join_tab->loosescan_match_tab &&
|
||||
join_tab->loosescan_match_tab->found_match)
|
||||
{
|
||||
KEY *key= join_tab->table->key_info + join_tab->index;
|
||||
KEY *key= join_tab->table->key_info + join_tab->loosescan_key;
|
||||
key_copy(join_tab->loosescan_buf, join_tab->table->record[0], key,
|
||||
join_tab->loosescan_key_len);
|
||||
skip_over= TRUE;
|
||||
@ -15382,7 +15382,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
|
||||
|
||||
if (skip_over && !error)
|
||||
{
|
||||
if(!key_cmp(join_tab->table->key_info[join_tab->index].key_part,
|
||||
if(!key_cmp(join_tab->table->key_info[join_tab->loosescan_key].key_part,
|
||||
join_tab->loosescan_buf, join_tab->loosescan_key_len))
|
||||
{
|
||||
/*
|
||||
|
Reference in New Issue
Block a user