Re: SQL error: function round(double precision, integer) does

From: TJ O'Donnell <tjo(at)acm(dot)org>
To: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org, adrian(dot)din(at)easynet(dot)ro, dev(at)archonet(dot)com
Subject: Re: SQL error: function round(double precision, integer) does
Date: 2005-02-28 14:40:24
Message-ID: 42232D58.90307@acm.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thanks everyone. Your tips about casting my arg to round()
as ::numeric worked just fine. I guess I was surprised
that plpgsql didn't that on it's own! I'm used to too
many forgiving c compilers, and such.

TJ

Christoph Haller wrote:
> TJ O'Donnell wrote:
>
>>I received the following error when executing a SQL statement:
>>
>>SQL error:
>>ERROR: function round(double precision, integer) does not exist
>>
>>In statement:
>>
>>select id,smiles,smarts,parameter,oe_count_matches(smiles,smarts) as count,
>> round((parameter*oe_count_matches(smiles,smarts)),2) as psa,tpsa(smiles) as ctpsa,tpsa
>> from structure,tpsa
>> where id < 237610
>> and oe_count_matches(smiles,smarts) > 0
>>
>>order by id;
>>
>>The functions described at:
>>http://www.postgresql.org/docs/7.4/static/functions-math.html
>>show that round(numeric,int) should work ok.
>>If I use round() without a second argument, it works OK, but
>>this gives a loss of precision which I do not want.
>>
>>Can anyone help me with this?
>>
>>Thanks,
>>TJ
>>
>
>
> And round(numeric,int) does work ok.
> The error message is telling you
> there is double precision argument where a numeric
> is expected.
> And with 7.4.5 it says in addition
> HINT: No function matches the given name and argument types.
> You may need to add explicit type casts.
>
> Try
> round((parameter*oe_count_matches(smiles,smarts))::numeric,2)
>
> Works for me with double precision arguments.
>
> Regards, Christoph

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2005-02-28 15:24:41 Re: diference in dates in minutes
Previous Message Joel Fradkin 2005-02-28 14:09:09 Re: diference in dates in minutes