1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fixed LP bug #707848.

This was another bug in the patch for bug 698882. The new
code from this patch did not ensured that substitutions
of fields for best equal fields were performed on all
AND-OR levels. As a result substitutions for best fields
in some predicates that had been used by the range optimizer
were not actually performed while range plans could employ
these substitutions. This could lead to inconsistent data
structures and ultimately to a crash.
This commit is contained in:
Igor Babaev
2011-01-26 20:45:23 -08:00
parent a624f99e98
commit 3e868cd3cb
3 changed files with 56 additions and 4 deletions

View File

@ -9902,12 +9902,16 @@ static COND* substitute_for_best_equal_field(COND *cond,
cond= eliminate_item_equal(0, cond_equal, item_equal);
return cond ? cond : org_cond;
}
else if (cond_equal)
else
{
List_iterator_fast<Item_equal> it(cond_equal->current_level);
while((item_equal= it++))
while (cond_equal)
{
cond= cond->transform(&Item::replace_equal_field, (uchar *) item_equal);
List_iterator_fast<Item_equal> it(cond_equal->current_level);
while((item_equal= it++))
{
cond= cond->transform(&Item::replace_equal_field, (uchar *) item_equal);
}
cond_equal= cond_equal->upper_levels;
}
}
return cond;