summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2017-03-03 01:37:54 +0200
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2017-03-03 01:37:54 +0200
commit1acfa942edb72fedcf92dd017ae5fef8694382e5 (patch)
tree721fcd9a479ce34633659c936f36fa1e20856620 /sql/opt_range.cc
parentcc413ce9a368b930aba5e63c0ab013f7b3ab3c04 (diff)
parent5a0fff50f87e20c4e95a84143a0a3bb67e03e29e (diff)
downloadmariadb-git-1acfa942edb72fedcf92dd017ae5fef8694382e5.tar.gz
Merge branch '5.5' into 10.0
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc25
1 files changed, 16 insertions, 9 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 5d6891a1edf..8f9d5abfa4d 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -8067,8 +8067,15 @@ static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond)
if (cond_func->functype() == Item_func::BETWEEN ||
cond_func->functype() == Item_func::IN_FUNC)
inv= ((Item_func_opt_neg *) cond_func)->negated;
- else if (cond_func->select_optimize() == Item_func::OPTIMIZE_NONE)
- DBUG_RETURN(0);
+ else
+ {
+ MEM_ROOT *tmp_root= param->mem_root;
+ param->thd->mem_root= param->old_root;
+ Item_func::optimize_type opt_res= cond_func->select_optimize();
+ param->thd->mem_root= tmp_root;
+ if (opt_res == Item_func::OPTIMIZE_NONE)
+ DBUG_RETURN(0);
+ }
param->cond= cond;
@@ -9923,6 +9930,13 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
if (!tmp->next_key_part)
{
+ if (key2->use_count)
+ {
+ SEL_ARG *key2_cpy= new SEL_ARG(*key2);
+ if (key2_cpy)
+ return 0;
+ key2= key2_cpy;
+ }
/*
tmp->next_key_part is empty: cut the range that is covered
by tmp from key2.
@@ -9954,13 +9968,6 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
key2: [---]
tmp: [---------]
*/
- if (key2->use_count)
- {
- SEL_ARG *key2_cpy= new SEL_ARG(*key2);
- if (key2_cpy)
- return 0;
- key2= key2_cpy;
- }
key2->copy_max_to_min(tmp);
continue;
}