summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bar@bar.mysql.r18.ru>2003-07-14 19:28:36 +0500
committerunknown <bar@bar.mysql.r18.ru>2003-07-14 19:28:36 +0500
commit6b001731c1c5b31c50c7a6aa1ee8dec5ceb09f91 (patch)
tree0667ae289e93ee3455aa91b49232e5d5f83c73b1 /sql
parente7360f4989055695b845b757f0ae04709582b24a (diff)
downloadmariadb-git-6b001731c1c5b31c50c7a6aa1ee8dec5ceb09f91.tar.gz
COALESCE now aggregates its argument types in this way:
if some of the arguments is STRING_RESULT the STRING_RESULT else if some of the arguments is REAL_RESULT then REAL_RESULT else INT_RESULT
Diffstat (limited to 'sql')
-rw-r--r--sql/item_cmpfunc.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 326138d798d..ff805e05346 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1149,7 +1149,13 @@ void Item_func_coalesce::fix_length_and_dec()
{
set_if_bigger(max_length,args[i]->max_length);
set_if_bigger(decimals,args[i]->decimals);
+ cached_result_type=item_store_type(cached_result_type,
+ args[i]->result_type());
}
+ if (cached_result_type == STRING_RESULT)
+ agg_arg_collations(collation, args, arg_count);
+ else if (cached_result_type != REAL_RESULT)
+ decimals= 0;
}
/****************************************************************************