MDEV-4778: Incorrect results from Aria/MyISAM SELECT using index with prefix length on TEXT column

Backport the fix olav.sandstaa@sun.com-20101102184747-qfuntqwj021imy9r:
"Fix for Bug#52660 Perf. regr. using ICP for MyISAM on range queries on an index containing TEXT" 
(together with further fixes in that code) into MyISAM and Aria.
This commit is contained in:
Sergey Petrunya 2013-07-16 10:56:42 +04:00
commit 47c1b04079
10 changed files with 180 additions and 14 deletions

View file

@ -3802,6 +3802,25 @@ int ha_maria::multi_range_read_explain_info(uint mrr_mode, char *str,
Item *ha_maria::idx_cond_push(uint keyno_arg, Item* idx_cond_arg)
{
/*
Check if the key contains a blob field. If it does then MyISAM
should not accept the pushed index condition since MyISAM will not
read the blob field from the index entry during evaluation of the
pushed index condition and the BLOB field might be part of the
range evaluation done by the ICP code.
*/
const KEY *key= &table_share->key_info[keyno_arg];
for (uint k= 0; k < key->key_parts; ++k)
{
const KEY_PART_INFO *key_part= &key->key_part[k];
if (key_part->key_part_flag & HA_BLOB_PART)
{
/* Let the server handle the index condition */
return idx_cond_arg;
}
}
pushed_idx_cond_keyno= keyno_arg;
pushed_idx_cond= idx_cond_arg;
in_range_check_pushed_down= TRUE;