summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-12-03 20:43:54 +0400
committerAlexander Barkov <bar@mariadb.org>2015-12-03 20:43:54 +0400
commitd87bc55b05046d6484659286fa831ff10dbd3af9 (patch)
tree6b177a3a9fccbeb918a4db3a1c6059558b90142d /sql/item_func.cc
parent9f07c6b383d776d430510de1256b3e4e8680bc60 (diff)
downloadmariadb-git-d87bc55b05046d6484659286fa831ff10dbd3af9.tar.gz
MDEV-8630 Datetime value dropped in "INSERT ... SELECT ... ON DUPLICATE KEY"
Item_func_coalesce::fix_length_and_dec() calls Item_func::count_string_result_length()) which called agg_arg_charsets() with wrong flags, so the collation derivation of the COALESCE result was not properly set to DERIVATION_COERCIBLE. It erroneously stayed DERIVATION_NUMERIC. So GREATEST() misinterpreted the argument as a number rather that a string and did not calculate its own length properly.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index eb5b63f549e..9a38fc60b0d 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -719,7 +719,7 @@ void Item_func::count_real_length()
bool Item_func::count_string_result_length(enum_field_types field_type,
Item **items, uint nitems)
{
- if (agg_arg_charsets(collation, items, nitems, MY_COLL_ALLOW_CONV, 1))
+ if (agg_arg_charsets_for_string_result(collation, items, nitems, 1))
return true;
if (is_temporal_type(field_type))
count_datetime_length(items, nitems);