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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alex Hunsaker <badalex(at)gmail(dot)com>
Cc: Adam Radlowski <adamr(at)informatyka(dot)gdansk(dot)pl>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5605: round(attr_name,int) works bad
Date: 2010-08-06 17:30:17
Message-ID: 6781.1281115817@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alex Hunsaker <badalex(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Dean Rasheed 2010-08-06 18:29:17 Re: BUG #5606: DEFERRABLE and DEFERRABLE INITIALLY DEFERRED are the same
Previous Message Michael Meskes 2010-08-06 17:22:38 Re: BUG #5607: memmory leak in ecpg