summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-02-15 18:08:08 +0100
committerSergei Golubchik <sergii@pisem.net>2012-02-15 18:08:08 +0100
commit25609313ffbd9205e921d0793cf423f711d10ced (patch)
treef04a1c26fabcc5463aca51a860f03131e02d94f7 /sql/item_cmpfunc.cc
parent47a54a2e087a7c1fc861bcbc114c14987f492cfe (diff)
parent764eeeee74f999fe2107fc362236563be0025093 (diff)
downloadmariadb-git-25609313ffbd9205e921d0793cf423f711d10ced.tar.gz
5.3.4 merge
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index b3954c55394..4ea5e9534a8 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -5804,7 +5804,7 @@ longlong Item_equal::val_int()
void Item_equal::fix_length_and_dec()
{
- Item *item= get_first(NULL);
+ Item *item= get_first(NO_PARTICULAR_TAB, NULL);
eval_item= cmp_item::get_comparator(item->cmp_type(), item,
item->collation.collation);
}
@@ -5904,7 +5904,7 @@ CHARSET_INFO *Item_equal::compare_collation()
@retval 0 if no field found.
*/
-Item* Item_equal::get_first(Item *field_item)
+Item* Item_equal::get_first(JOIN_TAB *context, Item *field_item)
{
Item_equal_fields_iterator it(*this);
Item *item;
@@ -5932,18 +5932,24 @@ Item* Item_equal::get_first(Item *field_item)
in presense of SJM nests.
*/
- TABLE_LIST *emb_nest= field->table->pos_in_table_list->embedding;
+ TABLE_LIST *emb_nest;
+ if (context != NO_PARTICULAR_TAB)
+ emb_nest= context->emb_sj_nest;
+ else
+ emb_nest= field->table->pos_in_table_list->embedding;
if (emb_nest && emb_nest->sj_mat_info && emb_nest->sj_mat_info->is_used)
{
/*
- It's a field from an materialized semi-join. We can substitute it only
- for a field from the same semi-join. Find the first of such items.
+ It's a field from an materialized semi-join. We can substitute it for
+ - a constant item
+ - a field from the same semi-join
+ Find the first of such items:
*/
-
while ((item= it++))
{
- if (it.get_curr_field()->table->pos_in_table_list->embedding == emb_nest)
+ if (item->const_item() ||
+ it.get_curr_field()->table->pos_in_table_list->embedding == emb_nest)
{
/*
If we found given field then return NULL to avoid unnecessary