mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Bug #17043: Casting trimmed string to decimal loses precision
Results of string functions were being converted to decimals by first being converted to integers, resulting in a loss of precision. mysql-test/r/func_str.result: Add new results mysql-test/t/func_str.test: Add new regression test sql/item_strfunc.cc: Convert string function results to decimal using string-to-decimal conversion sql/item_strfunc.h: Add Item_str_func::val_decimal()
This commit is contained in:
@@ -684,4 +684,11 @@ insert into t1 values ('y,abc'),('y,abc');
|
||||
select c, substring_index(lcase(c), @q:=',', -1) as res from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 5.0 tests
|
||||
#
|
||||
# Bug #17043: Casting trimmed string to decimal loses precision
|
||||
#
|
||||
select cast(rtrim(' 20.06 ') as decimal(19,2));
|
||||
select cast(ltrim(' 20.06 ') as decimal(19,2));
|
||||
select cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2));
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
Reference in New Issue
Block a user