Re: BUG #5605: round(attr_name,int) works bad

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5605: round(attr_name,int) works bad
Дата
Msg-id 6781.1281115817@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #5605: round(attr_name,int) works bad  (Alex Hunsaker <badalex@gmail.com>)
Список pgsql-bugs
Alex Hunsaker <badalex@gmail.com> writes:
> On Fri, Aug 6, 2010 at 02:12, Adam Radlowski
>> select round(any_numeric_field*something,2) from any_table;
>> I get information, that the function dos not exist.

> Can we get the exact *input* and the error?  I cant replicate it here:
> select round(100::numeric*100, 2);

I'm betting that by "any_numeric_field", the OP actually means a float
field, or perhaps his "something" was float. There's no float variant of
two-parameter round():

regression=# \df round
                          List of functions
   Schema   | Name  | Result data type | Argument data types |  Type
------------+-------+------------------+---------------------+--------
 pg_catalog | round | double precision | double precision    | normal
 pg_catalog | round | numeric          | numeric             | normal
 pg_catalog | round | numeric          | numeric, integer    | normal
(3 rows)

Fix would be to cast the function's first parameter to numeric.
Or if you can't fool with the generated SQL, make your own
round(float8, int) that does that.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Alex Hunsaker
Дата:
Сообщение: Re: BUG #5605: round(attr_name,int) works bad
Следующее
От: Dean Rasheed
Дата:
Сообщение: Re: BUG #5606: DEFERRABLE and DEFERRABLE INITIALLY DEFERRED are the same