From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Erik Rijkers" <er(at)xs4all(dot)nl> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: to_number nl_NL.utf8 |
Date: | 2013-12-29 00:28:52 |
Message-ID: | 28623.1388276932@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
"Erik Rijkers" <er(at)xs4all(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | truong.hua | 2013-12-29 08:07:03 | BUG #8703: Server terminated while this query running |
Previous Message | Peter Eisentraut | 2013-12-28 03:50:37 | Re: BUG #8702: psql \df+ translate_columns[] overflow and unexpected gettext translation |