wrong behavior using to_char()

From: "Euler Taveira de Oliveira" <euler(at)timbira(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: wrong behavior using to_char()
Date: 2006-09-14 19:54:00
Message-ID: 3152.200.178.249.132.1158263640.squirrel@timbira.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

Hi,

I notice a strange behavior using to_char() function. I'm using locale
pt_BR but it could happen with any locale.

template1=# select to_char(12345.67, '999G999D999');
to_char
--------------
12,345,670
(1 registro)

In the pt_BR locale, the thousand separator is "". So it should return
12345,670. Looking at the source, I saw that the test cases for locale
properties are independent among them. I think that the correct form is to
have all-or-nothing test case or didn't test *lconv->property ("" is
evaluated to false). Attached is a patch that fixes it using the second
option.

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

Attachment Content-Type Size
x application/octet-stream 1.9 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2006-09-14 20:11:56 Re: pgsql on Solaris 10
Previous Message viniciusasousa 2006-09-14 12:48:04 BUG #2628: jdbc2

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-09-14 22:52:36 Re: wrong behavior using to_char()
Previous Message Bruce Momjian 2006-09-14 19:49:17 Re: [HACKERS] Resurrecting per-page cleaner for