mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Stupid error message for 'insert "aaa"' into decimal column fixed
mysql-test/r/row.result: test result fixed sql/item.cc: error message for the case of bad decimal value added duplicated code removed
This commit is contained in:
@ -15,7 +15,7 @@ select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
|
|||||||
row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'))
|
row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'))
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Error 1366 Incorrect decimal value: '' for column '' at row -1
|
Warning 1292 Truncated incorrect DECIMAL value: 'a'
|
||||||
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
|
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
|
||||||
row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3))
|
row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3))
|
||||||
1
|
1
|
||||||
|
16
sql/item.cc
16
sql/item.cc
@ -260,8 +260,15 @@ my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value)
|
|||||||
return 0; // NULL or EOM
|
return 0; // NULL or EOM
|
||||||
|
|
||||||
end_ptr= (char*) res->ptr()+ res->length();
|
end_ptr= (char*) res->ptr()+ res->length();
|
||||||
str2my_decimal(E_DEC_FATAL_ERROR, res->ptr(), res->length(), res->charset(),
|
if (str2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM,
|
||||||
decimal_value);
|
res->ptr(), res->length(), res->charset(),
|
||||||
|
decimal_value) & E_DEC_BAD_NUM)
|
||||||
|
{
|
||||||
|
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
ER_TRUNCATED_WRONG_VALUE,
|
||||||
|
ER(ER_TRUNCATED_WRONG_VALUE), "DECIMAL",
|
||||||
|
str_value.c_ptr());
|
||||||
|
}
|
||||||
return decimal_value;
|
return decimal_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1457,10 +1464,7 @@ void Item_string::print(String *str)
|
|||||||
|
|
||||||
my_decimal *Item_string::val_decimal(my_decimal *decimal_value)
|
my_decimal *Item_string::val_decimal(my_decimal *decimal_value)
|
||||||
{
|
{
|
||||||
/* following assert is redundant, because fixed=1 assigned in constructor */
|
return val_decimal_from_string(decimal_value);
|
||||||
DBUG_ASSERT(fixed == 1);
|
|
||||||
string2my_decimal(E_DEC_FATAL_ERROR, &str_value, decimal_value);
|
|
||||||
return (decimal_value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user