diff options
author | unknown <jimw@mysql.com> | 2006-03-14 02:04:43 -0800 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2006-03-14 02:04:43 -0800 |
commit | d48cfa8ac7b7e240b883cbe2287c7f5729e37140 (patch) | |
tree | 2033188416a3c924f91998eeca2181e1a9de3508 /mysql-test/t/func_str.test | |
parent | 358e08836a1647a90ad3ecfc9dcef3549c00f4fe (diff) | |
download | mariadb-git-d48cfa8ac7b7e240b883cbe2287c7f5729e37140.tar.gz |
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()
Diffstat (limited to 'mysql-test/t/func_str.test')
-rw-r--r-- | mysql-test/t/func_str.test | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index ef20d766bce..85cedee0f4a 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -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 |