Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDxAZ-0000WQ-VO for pgsql-sql@arkaria.postgresql.org; Thu, 25 May 2017 18:07:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dDxAZ-0008JN-Eq for pgsql-sql@arkaria.postgresql.org; Thu, 25 May 2017 18:07:31 +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 1dDx9Z-0006Vv-68 for pgsql-sql@postgresql.org; Thu, 25 May 2017 18:06:29 +0000 Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dDx9V-0006EG-Rx for pgsql-sql@postgresql.org; Thu, 25 May 2017 18:06:28 +0000 Received: by mail-pf0-x235.google.com with SMTP id 9so173996205pfj.1 for ; Thu, 25 May 2017 11:06:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:thread-topic:thread-index:date:message-id :references:in-reply-to:content-language:mime-version; bh=E7Eq0Yh0jmvJ0JYgYqW6KDQhgd2kxBXzG9Ok9JksZbQ=; b=QYajAAKec2G/7JiYZDT+iRqB3tv7RV9R1K985MxRqRo+MXgyY/kOqAh02DPoCdwStk 5d75UrSssrAY6RGgZzftALhGnOj2K/shUx+UcZMjeDS1MOyk8+SxYnQxMsxYW7OqFlzm YPjksFAIyQZW1kgtlmoqizRKiPnrrwUVmT34JrG3U5ucPCXdHE3LXm77Z2MFnnY2CXC+ 0x6OnkPxRYf3QnswQ30McuOsKdq9Zl9+fYSv9mMd5WfjM8nKxXeYVZf9XTTuclMTfw3Y fy0el8zvP45w1aRjY8C10xMqbNcmkgzc2t242USbQk+tdVrbAH0xBnDIL4AyGD5h0FLD jLrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:thread-topic:thread-index :date:message-id:references:in-reply-to:content-language :mime-version; bh=E7Eq0Yh0jmvJ0JYgYqW6KDQhgd2kxBXzG9Ok9JksZbQ=; b=trhABq5AAvu+fVkaGuInmSBOgw5QKYnUrZDa0IG4cXZ1SyF9FVw580cadRtl1PcCod Q1+pkX5QhIz2KlE+3q1oVxciOKogshz4CGZg5YhkK0poeMWujFo+5d2E2xXqIRPb9Zd+ 5jdBXCxuVRSRbfLHC+lgH8BleqeRAac759tjFh8+eAHDwOxANQ6bzcMD8Esiy+GIIgMe KqY82V/pR/eIpP76HYZphMKrcboIwgXH3IHBxX5FACRw4yGZ5sg4CrkzrcYqmB4EAMwV kctWSTbZzHVW/f5r1g8LRRkn0kbPQ/pCfNcFnD+g9pciREDIpIgeRiGf3XCTGIsbJS8o RnlA== X-Gm-Message-State: AODbwcBYsZWfRRDb18mCoPXM9qY/DGnK+d2NwuCCYUFT0INWK0Cn9YnO 6Npnugc+vR2BUg== X-Received: by 10.99.95.138 with SMTP id t132mr47170630pgb.212.1495735583587; Thu, 25 May 2017 11:06:23 -0700 (PDT) Received: from DB6P195MB0056.EURP195.PROD.OUTLOOK.COM ([40.101.47.85]) by smtp.gmail.com with ESMTPSA id e76sm13358120pfh.121.2017.05.25.11.06.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 May 2017 11:06:22 -0700 (PDT) From: Vladimir Nicolici To: Tom Lane CC: "pgsql-sql@postgresql.org" Subject: Re: Re: SQL error: function round(double precision, integer) does not exist Thread-Topic: [SQL] Re: SQL error: function round(double precision, integer) does not exist Thread-Index: ATA2RDAwY68H4oFWaPnM164+C7VH4Tg0NTEww3zWHGw= X-MS-Exchange-MessageSentRepresentingType: 2 Date: Thu, 25 May 2017 17:55:20 +0000 Message-ID: References: ,<16203.1495734888@sss.pgh.pa.us> In-Reply-To: <16203.1495734888@sss.pgh.pa.us> Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: multipart/alternative; boundary="_000_DB6P195MB0056E207F3CE474BE77AA368F7FF0DB6P195MB0056EURP_" MIME-Version: 1.0 X-Pg-Spam-Score: -2.0 (--) 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 --_000_DB6P195MB0056E207F3CE474BE77AA368F7FF0DB6P195MB0056EURP_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable I do that, but it=92s extremely annoying. Every time I hit this issue it looks to me like a PostgreSQL bug that I nee= d to workaround for. Especially since other database products make this con= version automatically, and I have built muscle memory for that. Furthermore, since the single parameter version accepts double precision nu= mbers, the imprecise representation excuse seems questionable at best. Anyway, I=92ll try to use the double precision data type as little as possi= ble, since it causes these annoyances. @David, I=92m aware it=92s been 12 years since the original post. From: Tom Lane Sent: Thursday, May 25, 2017 20:54 To: Vladimir Nicolici Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Re: SQL error: function round(double precision, integer)= does not exist Vladimir Nicolici writes: > Any plans to fix this annoyance? Not particularly. Making round() work with floats seems questionable, since the result frequently couldn't be represented exactly, making the whole exercise a bit pointless. Why don't you cast the float to numeric? regards, tom lane --_000_DB6P195MB0056E207F3CE474BE77AA368F7FF0DB6P195MB0056EURP_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

I do that, but it=92s extremely annoying.

 

Every time I hit this issue it looks to me like a Po= stgreSQL bug that I need to workaround for. Especially since other database= products make this conversion automatically, and I have built muscle memor= y for that.

 

Furthermore, since the single parameter version acce= pts double precision numbers, the imprecise representation excuse seems que= stionable at best.

 

Anyway, I=92ll try to use the double precision data = type as little as possible, since it causes these annoyances.

 

@David, I=92m aware it=92s been 12 years since the o= riginal post.

 

From: Tom Lane
Sent: Thursday, May 25, 2017 20:54
To: Vladimir Nicolici
Cc: pgsql-sql@postgresql= .org
Subject: Re: [SQL] Re: SQL error: function round(double precision, i= nteger) does not exist

 

Vladimir Nicolici &= lt;vladnc@gmail.com> writes:
> Any plans to fix this annoyance?

Not particularly.  Making round() work with floats seems questionable,=
since the result frequently couldn't be represented exactly, making the
whole exercise a bit pointless.  Why don't you cast the float to numer= ic?

            &nb= sp;           regards, to= m lane

 

--_000_DB6P195MB0056E207F3CE474BE77AA368F7FF0DB6P195MB0056EURP_--