Commit b9fc8e1f authored by ramil@mysql.com's avatar ramil@mysql.com

Bug #17896: MIN of CASE WHEN returns non-minimum value!

- after review fixes
parent 78adb4bc
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment