agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Christoph Haller <ch@rodos.fzk.de>
To: tjo@acm.org
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL error: function round(double precision, integer) does not
Date: Mon, 28 Feb 2005 14:37:58 +0100
Message-ID: <42231EB6.9F6D20F3@rodos.fzk.de> (raw)
References: <4222570F.5080901@acm.org>
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
view thread (16+ messages) latest in thread
Message-ID: <42231EB6.9F6D20F3@rodos.fzk.de>
Permalink: ../42231EB6.9F6D20F3@rodos.fzk.de/
Also on: postgresql.org/message-id/42231EB6.9F6D20F3@rodos.fzk.de
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: ch@rodos.fzk.de, tjo@acm.org
Subject: Re: SQL error: function round(double precision, integer) does not
In-Reply-To: <42231EB6.9F6D20F3@rodos.fzk.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox