diff options
-rw-r--r-- | sql/item_cmpfunc.cc | 6 |
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) |