summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2013-04-08 12:04:28 +0300
committerunknown <timour@askmonty.org>2013-04-08 12:04:28 +0300
commit385de8743added00cfaece08720e3a9a789760a5 (patch)
tree63e1e6617d0a26dd200d7034bdd03904db1ceb5d /sql/opt_range.cc
parent69559b921342816b20fab7c890ab6d6488201730 (diff)
downloadmariadb-git-385de8743added00cfaece08720e3a9a789760a5.tar.gz
If a range tree has a branch that is an expensive constant,
currently get_mm_tree skipped the evaluation of this constant and icorrectly proceeded. The correct behavior is to return a NULL subtree, according to the IF branch being fixed - when it evaluates the constant it returns a value, and doesn't continue further.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 2cab05b26ab..af47578e8e3 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -7244,8 +7244,10 @@ static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond)
DBUG_RETURN(tree);
}
/* Here when simple cond */
- if (cond->const_item() && !cond->is_expensive())
+ if (cond->const_item())
{
+ if (cond->is_expensive())
+ DBUG_RETURN(0);
/*
During the cond->val_int() evaluation we can come across a subselect
item which may allocate memory on the thd->mem_root and assumes