Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eqMtD-0007QP-D0 for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Feb 2018 17:48:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eqMtB-0004a4-8J for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Feb 2018 17:48:37 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eqMtA-0004Zv-T1 for pgsql-bugs@lists.postgresql.org; Mon, 26 Feb 2018 17:48:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eqMt7-0003xE-4z for pgsql-bugs@lists.postgresql.org; Mon, 26 Feb 2018 17:48:35 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w1QHmTM6027577; Mon, 26 Feb 2018 12:48:29 -0500 From: Tom Lane To: michael.aiello@asg.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15091: to_number() returns incorrect value In-reply-to: <151965334143.21242.9862077287740270901@wrigleys.postgresql.org> References: <151965334143.21242.9862077287740270901@wrigleys.postgresql.org> Comments: In-reply-to =?utf-8?q?PG_Bug_reporting_form?= message dated "Mon, 26 Feb 2018 13:55:41 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27575.1519667309.1@sss.pgh.pa.us> Date: Mon, 26 Feb 2018 12:48:29 -0500 Message-ID: <27576.1519667309@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =?utf-8?q?PG_Bug_reporting_form?= writes: > When to_number is called with a string that contains a decimal point, but > there is no decimal indicator in the format string, the decimal digits are > appended to the integer portion, having the effect of increasing the the > integer value. > This can be reproduced with a simple SELECT, as follows: > SELECT to_number('123.0', 'FM9999999'); > returns value 1230 [ experiments ... ] I get the same result on Oracle, so I'd say this is the "correct" behavior. > by comparison, a decimal indicator in the format returns the correct > value: > SELECT to_number('123.0', 'FM99999D999'); > returns 123.0 On the other hand, Oracle also returns 1230 for this case :-(. But that seems to be a locale issue --- if I change the D to "." I get the expected result 123. Tested at http://rextester.com/l/oracle_online_compiler regards, tom lane