wrong behavior using to_char() - Mailing list pgsql-bugs

From Euler Taveira de Oliveira
Subject wrong behavior using to_char()
Date
Msg-id 3152.200.178.249.132.1158263640.squirrel@timbira.com
Whole thread Raw
Responses Re: wrong behavior using to_char()
Re: wrong behavior using to_char()
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pgsql on Solaris 10
Next
From: Tom Lane
Date:
Subject: Re: wrong behavior using to_char()