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 8AE6D564E6 for ; Mon, 28 Feb 2005 14:40:41 +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 13372-02 for ; Mon, 28 Feb 2005 14:40:31 +0000 (GMT) Received: from fed1rmmtao07.cox.net (fed1rmmtao07.cox.net [68.230.241.32]) by svr1.postgresql.org (Postfix) with ESMTP id 77B75563FD for ; Mon, 28 Feb 2005 14:40:30 +0000 (GMT) Received: from [192.168.1.200] (really [68.111.226.8]) by fed1rmmtao07.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050228144027.RMTK13104.fed1rmmtao07.cox.net@[192.168.1.200]>; Mon, 28 Feb 2005 09:40:27 -0500 Message-ID: <42232D58.90307@acm.org> Date: Mon, 28 Feb 2005 06:40:24 -0800 From: TJ O'Donnell Reply-To: tjo@acm.org User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christoph Haller Cc: pgsql-sql@postgresql.org, adrian.din@easynet.ro, dev@archonet.com Subject: Re: SQL error: function round(double precision, integer) does References: <4222570F.5080901@acm.org> <42231EB6.9F6D20F3@rodos.fzk.de> In-Reply-To: <42231EB6.9F6D20F3@rodos.fzk.de> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/352 X-Sequence-Number: 20462 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