Commit 147721bb authored by unknown's avatar unknown

Fix bug lp:889744

MariaDB 5.5 merges changes from MySQL 5.5 where all constant
expressions are wrapped into an Item_cache. As a result, constant
single-row subqueries were also wrapped in an Item_cache.
When analyzing the where clause for constant expressions that
can be evaluated during optimization, subqueries wrapped into
an Item_cache did not appear as expensive, and were therefore
evaluated during optimization. Such evaluation is against the
current architecture of MariaDB 5.3 where subquries are executed
during the execute phase.

The patch adds the is_expensive() predicate to Item_cache.
This makes Item_cache consistent with other wrapping Item
classes that need to look at the properties of the wrapped
object.
parent c25f4725
...@@ -3637,6 +3637,20 @@ class Item_cache: public Item_basic_constant ...@@ -3637,6 +3637,20 @@ class Item_cache: public Item_basic_constant
virtual void store(Item *item); virtual void store(Item *item);
virtual bool cache_value()= 0; virtual bool cache_value()= 0;
bool is_null() { return null_value; } bool is_null() { return null_value; }
virtual bool is_expensive()
{
DBUG_ASSERT(example);
if (value_cached)
return false;
return example->is_expensive();
}
bool is_expensive_processor(uchar *arg)
{
DBUG_ASSERT(example);
if (value_cached)
return false;
return example->is_expensive_processor(arg);
}
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment