Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDxQI-0001aQ-4X for pgsql-sql@arkaria.postgresql.org; Thu, 25 May 2017 18:23:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dDxQH-0001id-NY for pgsql-sql@arkaria.postgresql.org; Thu, 25 May 2017 18:23:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dDxPH-0008M0-BV for pgsql-sql@postgresql.org; Thu, 25 May 2017 18:22:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dDxPE-0006WX-TP for pgsql-sql@postgresql.org; Thu, 25 May 2017 18:22:42 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v4PIMc7h026295; Thu, 25 May 2017 14:22:38 -0400 From: Tom Lane To: Vladimir Nicolici cc: "pgsql-sql@postgresql.org" Subject: Re: Re: SQL error: function round(double precision, integer) does not exist In-reply-to: References: ,<16203.1495734888@sss.pgh.pa.us> Comments: In-reply-to Vladimir Nicolici message dated "Thu, 25 May 2017 17:55:20 -0000" Date: Thu, 25 May 2017 14:22:37 -0400 Message-ID: <16285.1495736557@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Vladimir Nicolici writes: > I do that, but itÂ’s extremely annoying. Well, if it rises to the level of extreme annoyance for you, there is a simple solution: create function round(float8, int) returns numeric as 'select round($1::numeric, $2)' language sql; > Furthermore, since the single parameter version accepts double precision numbers, the imprecise representation excuse seems questionable at best. The single-parameter version always rounds to integer, which avoids the problem of not being able to represent decimal fractions exactly. regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql