BUG #15091: to_number() returns incorrect value
От | PG Bug reporting form |
---|---|
Тема | BUG #15091: to_number() returns incorrect value |
Дата | |
Msg-id | 151965334143.21242.9862077287740270901@wrigleys.postgresql.org обсуждение исходный текст |
Ответы |
Re: BUG #15091: to_number() returns incorrect value
|
Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 15091 Logged by: Michael Aiello Email address: michael.aiello@asg.com PostgreSQL version: 9.6.6 Operating system: Windows 10 Description: When to_number is called with a string that contains a decimal point, but there is no decimal indicator in the format string, the decimal digits are appended to the integer portion, having the effect of increasing the the integer value. This can be reproduced with a simple SELECT, as follows: SELECT to_number('123.0', 'FM9999999'); returns value 1230 by comparison, a decimal indicator in the format returns the correct value: SELECT to_number('123.0', 'FM99999D999'); returns 123.0 I would expect one of two behaviors when the decimal place is present in the string to convert, but not the format, either: a) truncate the value at the decimal point, discarding the decimal portion. In this case, the first example above would return the integer 123, or b) raise a number format exception. Thanks Mike Aiello
В списке pgsql-bugs по дате отправления: