Bug with locale (decimale/group seperator in numbers)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
If PostgreSQL failed to compile on your computer or you found a bug that
is likely to be specific to one platform then please fill out this form
and e-mail it to pgsql-ports@postgresql.org.
To report any other bug, fill out the form below and e-mail it to
pgsql-bugs@postgresql.org.
If you not only found the problem but solved it and generated a patch
then e-mail it to pgsql-patches@postgresql.org instead. Please use the
command "diff -c" to generate the patch.
You may also enter a bug report at http://www.postgresql.org/ instead of
e-mail-ing this form.
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Hannes Wenzel
Your email address : hannes.wenzel@aon.at
System Configuration
- ---------------------
Architecture (example: Intel Pentium) : Intel Pentium III, 1133 MHz
Operating System (example: Linux 2.0.26 ELF) : Linux 2.4.20 ELF
PostgreSQL version (example: PostgreSQL-7.3.2): PostgreSQL-7.3.2
Compiler used (example: gcc 2.95.2) : gcc 3.2.3
Please enter a FULL description of your problem:
- ------------------------------------------------
A select with a to_char function to convert number to formated output with
locale support produces wrong group seperator characters.
The to_char function show a ',' as group seperator and ',' as decimal point.
So the group seperator is wrong, the decimal point is ok.
Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
- ----------------------------------------------------------------------
Created a database cluster with:
# initdb --pgdata=/home/postgres/db/home --locale=de_AT.iso885915@euro
- --username=han
then the database with:
# createdb --owner han home
The Unix user id is 'postgres' the LANG environment variable was set to
'de_AT.iso885915@euro'.
The description of the corresponding table is:
home=# \d eur
Tabelle »public.eur«
Spalte | Typ | Attribute
- --------+-----------------------------+-----------------------------------------------------
id | integer | not null default
nextval('public.eur_id_seq'::text)
datum | timestamp without time zone | not null
curr | integer | not null
val | numeric(15,5) | not null
Indizies: eur_pkey Primärschlüssel btree (id)
Foreign-Key-Constraints: $1 FOREIGN KEY (curr) REFERENCES currency(id) ON
UPDATE NO ACTION ON DELETE NO ACTION
Inserted some values into the table. The following select shows the following
output:
home=# select val,to_char(val,'999G999G990D00') from eur;
1719000.00000 | 1,719,000,00
1389.50000 | 1,389,50
37737.00000 | 37,737,00
1737000.00000 | 1,737,000,00
The correct output should be as follows:
1719000.00000 | 1.719.000,00
1389.50000 | 1.389,50
37737.00000 | 37.737,00
1737000.00000 | 1.737.000,00
Feel free to contact me per e-mail if you have further questions.
- --
lg, Hannes
____________________________________________________________________
Key fingerprint = 33A2 A4F8 E6B9 C83F 65EF 7FD9 A6C2 3EDF DD3B 2E59
____________________________________________________________________
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
iD8DBQE+ywBkpsI+3907LlkRApxjAJ9s7E1Wiq9UWTP+lGMbzT7DR3Mn4gCfadam
dH/MqdxiRnAbbF1VaCyRw9M=
=hnri
-----END PGP SIGNATURE-----
Hannes Wenzel <h.wenzel@aon.at> writes:
A select with a to_char function to convert number to formated output with
locale support produces wrong group seperator characters.
I think this must be a bug in the definition of that particular locale
on your system. I get reasonable-looking behavior here:
regression=# select to_char(1719000.00000,'999G999G990D00');
to_char
-----------------
1,719,000.00
(1 row)
regression=# set lc_numeric TO 'de_DE.iso885915@euro';
SET
regression=# select to_char(1719000.00000,'999G999G990D00');
to_char
-----------------
1.719.000,00
(1 row)
regards, tom lane