Commit 5a677749 authored by Sergey Petrunya's avatar Sergey Petrunya

MDEV-6808, part#2.

Fix apparently-wrong code in table_multi_eq_selectivity().
parent 9aeeba48
...@@ -7199,17 +7199,20 @@ double table_multi_eq_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s, ...@@ -7199,17 +7199,20 @@ double table_multi_eq_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
uint i; uint i;
KEYUSE *keyuse= pos->key; KEYUSE *keyuse= pos->key;
uint key= keyuse->key; uint key= keyuse->key;
// psergey-todo: why does the following loop not include 'i' ???
for (i= 0; i < keyparts; i++) for (i= 0; i < keyparts; i++)
{ {
if (i > 0)
keyuse+= ref_keyuse_steps[i-1];
uint fldno; uint fldno;
if (is_hash_join_key_no(key)) if (is_hash_join_key_no(key))
fldno= keyuse->keypart; fldno= keyuse->keypart;
else else
fldno= table->key_info[key].key_part[keyparts-1].fieldnr - 1; fldno= table->key_info[key].key_part[i].fieldnr - 1;
if (fld->field_index == fldno) if (fld->field_index == fldno)
break; break;
} }
keyuse= pos->key;
if (i == keyparts) if (i == keyparts)
{ {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment