summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@sun.com>2009-08-28 12:55:59 +0200
committerMattias Jonsson <mattias.jonsson@sun.com>2009-08-28 12:55:59 +0200
commit0a76397171c3e53402aab78f9a6261bdfa2fca3c (patch)
tree810fbe1527988b56b8833ff44e31f1a6f4ab4484 /sql/opt_range.cc
parentcb57e856b64689dc6b4209817b33ca7bfff73efa (diff)
parent4655118bea2bcb14a06f01046fb06052fd37214c (diff)
downloadmariadb-git-0a76397171c3e53402aab78f9a6261bdfa2fca3c.tar.gz
Manual merge between bug#46362 and bug#20577.
sql/opt_range.cc: Removed duplicate code (if statement must have been duplicated during earlier merge). sql/sql_partition.cc: After mergeing bug#46362 and bug#20577, the NULL partition was also searched when col = const, fixed by checking if = or range.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc22
1 files changed, 10 insertions, 12 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 8dc2f4683dd..23126069a5d 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -5856,7 +5856,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
but we'll need to convert '>' to '>=' and '<' to '<='. This will
be done together with other types at the end of this function
- (grep for field_is_equal_to_item)
+ (grep for stored_field_cmp_to_item)
*/
}
else
@@ -5934,7 +5934,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
switch (type) {
case Item_func::LT_FUNC:
- if (field_is_equal_to_item(field,value))
+ if (stored_field_cmp_to_item(field,value) == 0)
tree->max_flag=NEAR_MAX;
/* fall through */
case Item_func::LE_FUNC:
@@ -5948,11 +5948,16 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
break;
case Item_func::GT_FUNC:
/* Don't use open ranges for partial key_segments */
- if (field_is_equal_to_item(field,value) &&
- !(key_part->flag & HA_PART_KEY_SEG))
+ if ((!(key_part->flag & HA_PART_KEY_SEG)) &&
+ (stored_field_cmp_to_item(field, value) <= 0))
tree->min_flag=NEAR_MIN;
- /* fall through */
+ tree->max_flag= NO_MAX_RANGE;
+ break;
case Item_func::GE_FUNC:
+ /* Don't use open ranges for partial key_segments */
+ if ((!(key_part->flag & HA_PART_KEY_SEG)) &&
+ (stored_field_cmp_to_item(field,value) < 0))
+ tree->min_flag= NEAR_MIN;
tree->max_flag=NO_MAX_RANGE;
break;
case Item_func::SP_EQUALS_FUNC:
@@ -6443,13 +6448,6 @@ key_and(RANGE_OPT_PARAM *param, SEL_ARG *key1, SEL_ARG *key2, uint clone_flag)
return 0; // Can't optimize this
}
- if ((key1->min_flag | key2->min_flag) & GEOM_FLAG)
- {
- key1->free_tree();
- key2->free_tree();
- return 0; // Can't optimize this
- }
-
key1->use_count--;
key2->use_count--;
SEL_ARG *e1=key1->first(), *e2=key2->first(), *new_tree=0;