1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +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

@ -1030,3 +1030,13 @@ c res
y,abc abc
y,abc abc
drop table t1;
select cast(rtrim(' 20.06 ') as decimal(19,2));
cast(rtrim(' 20.06 ') as decimal(19,2))
20.06
select cast(ltrim(' 20.06 ') as decimal(19,2));
cast(ltrim(' 20.06 ') as decimal(19,2))
20.06
select cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2));
cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2))
20.06
End of 5.0 tests