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 4F87A566D8 for ; Mon, 28 Feb 2005 16:33:26 +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 49560-06 for ; Mon, 28 Feb 2005 16:33:21 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id C05A6565B2 for ; Mon, 28 Feb 2005 16:33:19 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id j1SGXB9s046310 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 28 Feb 2005 09:33:14 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id j1SGXB5p012124; Mon, 28 Feb 2005 09:33:11 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id j1SGXBQi012096; Mon, 28 Feb 2005 09:33:11 -0700 (MST) (envelope-from mfuhr) Date: Mon, 28 Feb 2005 09:33:10 -0700 From: Michael Fuhr To: "TJ O'Donnell" Cc: pgsql-sql@postgresql.org Subject: Re: SQL error: function round(double precision, integer) does not exist Message-ID: <20050228163309.GA105@winnie.fuhr.org> References: <4222570F.5080901@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4222570F.5080901@acm.org> 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/350 X-Sequence-Number: 20460 On Sun, Feb 27, 2005 at 03:26:07PM -0800, TJ O'Donnell wrote: > ERROR: function round(double precision, integer) does not exist ^^^^^^^^^^^^^^^^ [snip] > The functions described at: > http://www.postgresql.org/docs/7.4/static/functions-math.html > show that round(numeric,int) should work ok. ^^^^^^^ The two-argument form of round() expects the first argument to be numeric, not double precision. There's no implicit cast from double precision to numeric, so you'll have to use an explicit cast: SELECT ... round((expression)::numeric, 2) ... -- Michael Fuhr http://www.fuhr.org/~mfuhr/