summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorramil@mysql.com <>2006-04-21 11:48:00 +0500
committerramil@mysql.com <>2006-04-21 11:48:00 +0500
commitb9fc8e1f697f5bae808d94f7c5b3d5be10cff741 (patch)
treebb8fe84ecfbd518f45b63ab8aacb4879e4ff0b55 /sql/item_cmpfunc.cc
parent78adb4bc15d8700e8517e7bacc30c4470ab1d767 (diff)
downloadmariadb-git-b9fc8e1f697f5bae808d94f7c5b3d5be10cff741.tar.gz
Bug #17896: MIN of CASE WHEN returns non-minimum value!
- after review fixes
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 57a3c9e5623..3c41fb56d89 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -39,19 +39,23 @@ static void agg_result_type(Item_result *type, Item **items, uint nitems)
{
Item **item, **item_end;
- /* Note: NULL items don't affect the result type */
*type= STRING_RESULT;
/* Skip beginning NULL items */
for (item= items, item_end= item + nitems; item < item_end; item++)
+ {
if ((*item)->type() != Item::NULL_ITEM)
{
*type= (*item)->result_type();
item++;
break;
}
+ }
+ /* Combine result types. Note: NULL items don't affect the result */
for (; item < item_end; item++)
+ {
if ((*item)->type() != Item::NULL_ITEM)
*type= item_store_type(type[0], (*item)->result_type());
+ }
}
static void agg_cmp_type(Item_result *type, Item **items, uint nitems)