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

Fixed LP bug #707555.

The bug was in the code of the patch fixing bug 698882.
With improper casting the method store_key_field::change_source_field
was called for the elements of the array TABLE_REF::key_copy that
were either of a different type or not allocated at all. This caused
crashes in some queries.
This commit is contained in:
Igor Babaev
2011-01-26 11:30:29 -08:00
parent 1f970d41e8
commit a624f99e98
6 changed files with 179 additions and 5 deletions

View File

@ -1059,6 +1059,8 @@ JOIN::optimize()
Item **ref_item_ptr= tab->ref.items+i;
Item *ref_item= *ref_item_ptr;
if (!ref_item->used_tables() && !(select_options & SELECT_DESCRIBE))
continue;
COND_EQUAL *equals= tab->first_inner ? tab->first_inner->cond_equal :
cond_equal;
ref_item= substitute_for_best_equal_field(ref_item, equals, map2table);
@ -1067,10 +1069,11 @@ JOIN::optimize()
{
*ref_item_ptr= ref_item;
Item *item= ref_item->real_item();
if (item->type() == Item::FIELD_ITEM)
{
store_key_field *key_copy= (store_key_field *) tab->ref.key_copy[i];
key_copy->change_source_field((Item_field *) item);
store_key *key_copy= tab->ref.key_copy[i];
if (key_copy->type() == store_key::FIELD_STORE_KEY)
{
store_key_field *field_copy= ((store_key_field *)key_copy);
field_copy->change_source_field((Item_field *) item);
}
}
}