summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-09-17 11:05:07 +0400
committerAlexander Barkov <bar@mariadb.org>2015-09-17 11:05:07 +0400
commitd9b25ae3db8584bde809c0ab3230cbe151fa489b (patch)
treecb0ae8c91d4f1bcd614c3c1b2d7847f3ef7a130f /sql/item_strfunc.cc
parentc69cf93bfb3a221d9106f3695aa16e11f7e8b7fb (diff)
downloadmariadb-git-d9b25ae3db8584bde809c0ab3230cbe151fa489b.tar.gz
MDEV-8466 CAST works differently for DECIMAL/INT vs DOUBLE for empty strings
MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 7f466e86afb..ef2e96e8234 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -5081,13 +5081,15 @@ my_decimal *Item_dyncol_get::val_decimal(my_decimal *decimal_value)
break;
case DYN_COL_STRING:
{
+ const char *end;
int rc;
rc= str2my_decimal(0, val.x.string.value.str, val.x.string.value.length,
- val.x.string.charset, decimal_value);
+ val.x.string.charset, decimal_value, &end);
char buff[80];
strmake(buff, val.x.string.value.str, MY_MIN(sizeof(buff)-1,
val.x.string.value.length));
- if (rc != E_DEC_OK)
+ if (rc != E_DEC_OK ||
+ end != val.x.string.value.str + val.x.string.value.length)
{
THD *thd= current_thd;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,