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 1eqPRE-0001i2-Lm for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Feb 2018 20:31:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eqPRD-0000td-G6 for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Feb 2018 20:31:55 +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 1eqPRD-0000tU-6i for pgsql-bugs@lists.postgresql.org; Mon, 26 Feb 2018 20:31:55 +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 1eqPRA-0007c2-JO for pgsql-bugs@lists.postgresql.org; Mon, 26 Feb 2018 20:31:53 +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 w1QKVnvt008871; Mon, 26 Feb 2018 15:31:49 -0500 From: Tom Lane To: Andrew Gierth cc: michael.aiello@asg.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15091: to_number() returns incorrect value In-reply-to: <87muzvmtiw.fsf@news-spur.riddles.org.uk> References: <151965334143.21242.9862077287740270901@wrigleys.postgresql.org> <27576.1519667309@sss.pgh.pa.us> <87muzvmtiw.fsf@news-spur.riddles.org.uk> Comments: In-reply-to Andrew Gierth message dated "Mon, 26 Feb 2018 20:25:55 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8869.1519677109.1@sss.pgh.pa.us> Date: Mon, 26 Feb 2018 15:31:49 -0500 Message-ID: <8870.1519677109@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andrew Gierth writes: > "Tom" == Tom Lane writes: > Tom> Tested at > Tom> http://rextester.com/l/oracle_online_compiler > The problem is that this tester is defaulting to a German locale and > using . as a thousands separator and , as decimal point, as shown by > this query: > select * from nls_session_parameters > where parameter in ('NLS_TERRITORY','NLS_NUMERIC_CHARACTERS') Oh, thanks ... I was wondering what locale it had chosen, but did not know how to find out. > If you do > ALTER SESSION SET NLS_TERRITORY = 'AMERICA' \\ > SELECT to_number('123.0', 'FM9999999') FROM DUAL > then the result is, as expected, > ORA-01722: invalid number Hmm. That doesn't seem too helpful. Between throwing an error and returning "123", seems like the latter would be better. Do we want to be bug-compatible here? regards, tom lane