wrong behavior using to_char() again

From: Euler Taveira de Oliveira <euler(at)timbira(dot)com>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: wrong behavior using to_char() again
Date: 2007-11-17 19:53:53
Message-ID: 473F46D1.10605@timbira.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Hi,

Looking again at bug report [1], I agree that's a glibc bug. Numbers in
pt_BR has its format 1.234.567,89; sometimes the format 1234567,89 is
acceptable too, ie, the thousand separator is optional. I guess that
some locales use the 'optional' thousand separator too (yep, they are
all broken too).

euler(at)harman:/a/pgsql$ ./a.out pt_BR
decimal_point: ,
thousands_sep:
euler(at)harman:/a/pgsql$ ./a.out fr_FR
decimal_point: ,
thousands_sep:
euler(at)harman:/a/pgsql$ ./a.out es_ES
decimal_point: ,
thousands_sep:
euler(at)harman:/a/pgsql$ ./a.out de_DE
decimal_point: ,
thousands_sep: .
euler(at)harman:/a/pgsql$ ./a.out C
decimal_point: .
thousands_sep:

The actual behavior is set: (i) "," if the thousand separator is "" (ii)
"." if the decimal point is "". It is not what glibc says (even in the C
locale). I expect that PostgreSQL agrees with glibc (even it's the wrong
behavior). Given this assumption, i propose the attached patch (it needs
to adjust the regression tests).

Comments?

[1] http://archives.postgresql.org/pgsql-bugs/2006-09/msg00074.php

--
Euler Taveira de Oliveira
http://www.timbira.com/

Attachment Content-Type Size
t.c text/x-csrc 341 bytes
p.diff text/x-patch 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthew Grosso 2007-11-17 20:05:33 offtopic, historic, in 8.1, how to find relfrozenxid by table?
Previous Message Tom Lane 2007-11-17 17:27:48 VACUUM/ANALYZE counting of in-doubt tuples

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2007-11-18 14:42:54 Re: Better default_statistics_target
Previous Message Tom Lane 2007-11-16 22:58:23 Proposed patch for ANALYZE overcounting dead rows