diff options
author | Igor Babaev <igor@askmonty.org> | 2012-03-17 01:26:58 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-03-17 01:26:58 -0700 |
commit | 5d954e7cd0f9f4106d848a7d7fc8fbce35668785 (patch) | |
tree | bd812fb49b473d759c5054fe89d12e4dc1e50a59 /sql/opt_sum.cc | |
parent | d110e0377dda1bb9f5a5c36745d3a6feb8e8a1d4 (diff) | |
parent | 5338a28912589f1169b66b880a489ec5636bcd83 (diff) | |
download | mariadb-git-5d954e7cd0f9f4106d848a7d7fc8fbce35668785.tar.gz |
Merge 5.3->5.5
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r-- | sql/opt_sum.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index bdc8b768849..430c201d3e6 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -486,8 +486,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 */ @@ -507,6 +507,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; } @@ -540,6 +542,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 */ @@ -553,6 +557,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 |