1
0
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:
unknown
2006-03-14 02:04:43 -08:00
parent 358e08836a
commit d48cfa8ac7
4 changed files with 33 additions and 1 deletions

View File

@@ -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