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.
This commit is contained in:
unknown 2011-11-14 19:24:36 +02:00
parent c25f472599
commit 147721bbb6

View file

@ -3637,6 +3637,20 @@ public:
virtual void store(Item *item);
virtual bool cache_value()= 0;
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);
}
};