From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Locale number format confusion |
Date: | 2002-08-08 21:19:04 |
Message-ID: | Pine.LNX.4.44.0208082254190.927-100000@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
It seems we need a smart plan for handling the decimal point vs. comma
issue. Observe: (lc_numeric = de_DE)
create table test_f (x double precision);
CREATE TABLE
insert into test_f values ('1.5');
ERROR: Bad float8 input format '1.5'
insert into test_f values ('1,5');
INSERT 16909 1
create table test_n (x numeric);
CREATE TABLE
insert into test_n values ('1.5');
INSERT 16915 1
insert into test_n values ('1,5');
ERROR: Bad numeric input format '1,5'
create table test_p (x point);
CREATE TABLE
insert into test_p values ('(1.5, 2.4)');
ERROR: Bad point external representation '(1.5, 2.4)'
insert into test_p values ('(1,5, 2,4)');
INSERT 16918 1
insert into test_p values ('(9,5)');
ERROR: Bad point external representation '(9,5)'
peter=# insert into test_p values ('(9,5,1)');
INSERT 16919 1
select * from test_p;
x
-----------
(1,5,2,4)
(9,5,1) -- (What point is that?)
(Yes, we really need structured types, not the parse-your-own-string
extension interface.)
SQL99 effectively says that a decimal *point* should be used for casts
from numerical to character types and vice versa. (You can read about
this in 6.22 GR 6b, 7b, 8a, 8b -- there are pretty specific rules for
converting numbers to strings which we probably don't follow very
strictly.)
I propose that we do this (probably by writing our own strtod and
friends). If you want to format your numbers to local convention,
to_char() can be used.
Comments?
--
Peter Eisentraut peter_e(at)gmx(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | Nigel J. Andrews | 2002-08-08 21:36:06 | Re: [HACKERS] Linux Largefile Support In Postgresql RPMS |
Previous Message | Joe Conway | 2002-08-08 21:11:38 | Re: stand-alone composite types patch (was [HACKERS] Proposal: |