diff options
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 0fbb0fd5ec3..3e915363c12 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3058,11 +3058,14 @@ Item_sum_hybrid::min_max_update_str_field() if (!args[0]->null_value) { - result_field->val_str(&cmp->value2); - - if (result_field->is_null() || - (cmp_sign * sortcmp(res_str,&cmp->value2,collation.collation)) < 0) + if (result_field->is_null()) result_field->store(res_str->ptr(),res_str->length(),res_str->charset()); + else + { + result_field->val_str(&cmp->value2); + if ((cmp_sign * sortcmp(res_str,&cmp->value2,collation.collation)) < 0) + result_field->store(res_str->ptr(),res_str->length(),res_str->charset()); + } result_field->set_notnull(); } DBUG_VOID_RETURN; |