summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2011-11-14 19:24:36 +0200
committerunknown <timour@askmonty.org>2011-11-14 19:24:36 +0200
commit147721bbb69fef8923655482fafcf35d7a82e805 (patch)
treebb5fd17336ab2e4a465498ec806ee9371f7dcf91 /sql/item.h
parentc25f47259926fcc10d3a4e072fd44aeeba71f108 (diff)
downloadmariadb-git-147721bbb69fef8923655482fafcf35d7a82e805.tar.gz
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.
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h
index b858d8ce587..e05fbf3b67d 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -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);
+ }
};