summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index aa216849d76..e2761832e65 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -905,10 +905,17 @@ static SEL_TREE *
get_mm_parts(PARAM *param, Field *field, Item_func::Functype type,
Item *value, Item_result cmp_type)
{
+ bool ne_func= FALSE;
DBUG_ENTER("get_mm_parts");
if (field->table != param->table)
DBUG_RETURN(0);
+ if (type == Item_func::NE_FUNC)
+ {
+ ne_func= TRUE;
+ type= Item_func::LT_FUNC;
+ }
+
KEY_PART *key_part = param->key_parts;
KEY_PART *end = param->key_parts_end;
SEL_TREE *tree=0;
@@ -943,6 +950,14 @@ get_mm_parts(PARAM *param, Field *field, Item_func::Functype type,
tree->keys[key_part->key]=sel_add(tree->keys[key_part->key],sel_arg);
}
}
+
+ if (ne_func)
+ {
+ SEL_TREE *tree2= get_mm_parts(param, field, Item_func::GT_FUNC,
+ value, cmp_type);
+ if (tree2)
+ tree= tree_or(param,tree,tree2);
+ }
DBUG_RETURN(tree);
}