pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Erik Rijkers <er@xs4all.nl>
Cc: pgsql-bugs@postgresql.org
Subject: Re: to_number nl_NL.utf8
Date: Sat, 28 Dec 2013 19:28:52 -0500
Message-ID: <28623.1388276932@sss.pgh.pa.us> (raw)
In-Reply-To: <cb9a97b252be8157caf8988671322410.squirrel@webmail.xs4all.nl>
References: <4da5ec27260a33ce8b9ec8b031e6e4c1.squirrel@webmail.xs4all.nl>
	<cb9a97b252be8157caf8988671322410.squirrel@webmail.xs4all.nl>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

"Erik Rijkers" <er@xs4all.nl> 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



view thread (3+ messages)

Message-ID: <28623.1388276932@sss.pgh.pa.us>
Permalink:  ../28623.1388276932@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28623.1388276932@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, er@xs4all.nl
  Subject: Re: to_number nl_NL.utf8
  In-Reply-To: <28623.1388276932@sss.pgh.pa.us>
  References: <4da5ec27260a33ce8b9ec8b031e6e4c1.squirrel@webmail.xs4all.nl> <cb9a97b252be8157caf8988671322410.squirrel@webmail.xs4all.nl> <28623.1388276932@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox