X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F32045663C for ; Mon, 28 Feb 2005 13:38:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94994-05 for ; Mon, 28 Feb 2005 13:38:07 +0000 (GMT) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by svr1.postgresql.org (Postfix) with SMTP id 4BF0F565D4 for ; Mon, 28 Feb 2005 13:38:04 +0000 (GMT) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Mon Feb 28 14:38:01 2005 +0100 Received: from rodos.fzk.de (resy6.fzk.de [141.52.68.10]) by resy5.fzk.de (8.12.7/8.12.7/SuSE Linux 0.6) with ESMTP id j1SDc0sG012315; Mon, 28 Feb 2005 14:38:00 +0100 Message-ID: <42231EB6.9F6D20F3@rodos.fzk.de> Date: Mon, 28 Feb 2005 14:37:58 +0100 From: Christoph Haller X-Mailer: Mozilla 4.77 [en] (X11; U; HP-UX B.10.20 9000/780) X-Accept-Language: en MIME-Version: 1.0 To: tjo@acm.org Cc: pgsql-sql@postgresql.org Subject: Re: SQL error: function round(double precision, integer) does not References: <4222570F.5080901@acm.org> Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS - amavis-milter (http://www.amavis.org/) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.033 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/354 X-Sequence-Number: 20464 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