Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vx4FV-0007R3-CX for pgsql-bugs@arkaria.postgresql.org; Sun, 29 Dec 2013 00:28:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vx4FU-0000We-Ir for pgsql-bugs@arkaria.postgresql.org; Sun, 29 Dec 2013 00:28:56 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vx4FT-0000WX-I8 for pgsql-bugs@postgresql.org; Sun, 29 Dec 2013 00:28:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vx4FR-0000NU-5k for pgsql-bugs@postgresql.org; Sun, 29 Dec 2013 00:28:54 +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 rBT0Sq46028624; Sat, 28 Dec 2013 19:28:52 -0500 From: Tom Lane To: "Erik Rijkers" cc: pgsql-bugs@postgresql.org Subject: Re: to_number nl_NL.utf8 In-reply-to: References: <4da5ec27260a33ce8b9ec8b031e6e4c1.squirrel@webmail.xs4all.nl> Comments: In-reply-to "Erik Rijkers" message dated "Fri, 27 Dec 2013 23:22:52 +0100" Date: Sat, 28 Dec 2013 19:28:52 -0500 Message-ID: <28623.1388276932@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org "Erik Rijkers" writes: > I was trying to import values like '1.234,55' into a en_US.utf8 database with > to_number( '1.234,55' , '999G999D99') I don't think this has much of anything to do with locale. Observe basically the same behavior without any locale issues: regression=# select to_number( '1,234.55' , '999,999.99'); to_number ----------- 124.55 (1 row) regression=# select to_number( '1,234.55' , '99,999.99'); to_number ----------- 134.55 (1 row) regression=# select to_number( '1,234.55' , '9,999.99'); to_number ----------- 1234.55 (1 row) I think it's cueing off the number of "9"s to decide which characters mean what; which would be fine maybe, except it seems to change its mind once it hits the decimal point. If we're going to believe the input decimal point position for evaluating digits to its right, probably we should retroactively adjust what we thought of digits to its left, as well. Or maybe we shouldn't do either. Anyway, the short answer for the near future is if you're going to use to_number then the format ought to match the data. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs