summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2012-03-14 13:58:18 +0200
committerunknown <sanja@montyprogram.com>2012-03-14 13:58:18 +0200
commit5338a28912589f1169b66b880a489ec5636bcd83 (patch)
treed0e1156d56a95d2051d499b065d78395bc302528 /sql/opt_sum.cc
parent0f3b8ef28ed19145e0cd850ef522ddf7cf662592 (diff)
parente638e605895fb572047ec8027e91c5438d77cbf4 (diff)
downloadmariadb-git-5338a28912589f1169b66b880a489ec5636bcd83.tar.gz
Merge 5.2->5.3
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 5298c57954d..9e097af1e6e 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -482,8 +482,8 @@ int opt_sum_query(THD *thd,
'const op field'
@retval
- 0 func_item is a simple predicate: a field is compared with
- constants
+ 0 func_item is a simple predicate: a field is compared with a constant
+ whose length does not exceed the max length of the field values
@retval
1 Otherwise
*/
@@ -503,6 +503,8 @@ bool simple_pred(Item_func *func_item, Item **args, bool *inv_order)
if (!(item= it++))
return 0;
args[0]= item->real_item();
+ if (args[0]->max_length < args[1]->max_length)
+ return 0;
if (it++)
return 0;
}
@@ -536,6 +538,8 @@ bool simple_pred(Item_func *func_item, Item **args, bool *inv_order)
}
else
return 0;
+ if (args[0]->max_length < args[1]->max_length)
+ return 0;
break;
case 3:
/* field BETWEEN const AND const */
@@ -549,6 +553,8 @@ bool simple_pred(Item_func *func_item, Item **args, bool *inv_order)
if (!item->const_item())
return 0;
args[i]= item;
+ if (args[0]->max_length < args[i]->max_length)
+ return 0;
}
}
else