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 3A76556560 for ; Mon, 28 Feb 2005 10:39:56 +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 45964-09 for ; Mon, 28 Feb 2005 10:39:51 +0000 (GMT) Received: from mail.idilis.net (mail.idilis.net [217.156.85.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5ED2B564EA for ; Mon, 28 Feb 2005 10:39:49 +0000 (GMT) Received: from [82.76.81.98] (helo=adi) by mail.idilis.net with asmtp id 1D5iJV-00047W-00; Mon, 28 Feb 2005 12:39:45 +0200 Date: Mon, 28 Feb 2005 12:43:11 +0200 To: tjo@acm.org Subject: Re: SQL error: function round(double precision, integer) does not exist Cc: pgsql-sql@postgresql.org References: <4222570F.5080901@acm.org> From: Din Adrian Organization: Om Computer & Software Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <4222570F.5080901@acm.org> User-Agent: Opera M2/7.50 (Win32, build 3778) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/358 X-Sequence-Number: 20468 the round sintax is round(numeric,int) not round (double,int) you must cast the value into numeric: ex: round (cast(doublecolumn as numeric),2) should work ok Adrian Din, Om Computer & SoftWare On Sun, 27 Feb 2005 15:26:07 -0800, 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 > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/