diff options
author | Igor Babaev <igor@askmonty.org> | 2013-04-29 20:31:40 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2013-04-29 20:31:40 -0700 |
commit | 891bb60c31fc65148e8c07da084d0d8f50fc2ec9 (patch) | |
tree | 6b2d12c8e8af0ae11fe7fde9844159d38b1956fb /sql/sql_select.cc | |
parent | bfc6fa8c94f550f311b00c0d63372f3b75cf4b9b (diff) | |
download | mariadb-git-891bb60c31fc65148e8c07da084d0d8f50fc2ec9.tar.gz |
Fixed bug mdev-4274.
This bug was the result of incompleteness of the patch for bug mdev-4177.
When an OR condition is simplified to a single conjunct it is merged
into the embedding AND condition. Multiple equalities are also merged,
and any field item involved in those equality should acquire a pointer
to a the multiple equality formed by this merge.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6432142597f..410244b88f0 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -13195,7 +13195,24 @@ remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value) if (new_item_and_list->is_empty()) li.remove(); else - li.replace(*new_item_and_list); + { + Item *list_item; + Item *new_list_item; + List_iterator<Item> it(*new_item_and_list); + while ((list_item= it++)) + { + uchar* is_subst_valid= (uchar *) Item::ANY_SUBST; + new_list_item= + list_item->compile(&Item::subst_argument_checker, + &is_subst_valid, + &Item::equal_fields_propagator, + (uchar *) &cond_and->cond_equal); + if (new_list_item != list_item) + it.replace(new_list_item); + new_list_item->update_used_tables(); + } + li.replace(*new_item_and_list); + } cond_and_list->concat((List<Item>*) cond_equal_items); } else if (new_item->type() == Item::FUNC_ITEM && |