dbTalk Databases Forums  

Re: [BUGS] wrong behavior using to_char()

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss Re: [BUGS] wrong behavior using to_char() in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] wrong behavior using to_char() - 09-14-2006 , 05:56 PM






"Euler Taveira de Oliveira" <euler (AT) timbira (DOT) com> writes:
Quote:
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.
Not unless you have a solution to the problem seen in this thread:
http://archives.postgresql.org/pgsql...2/msg00172.php

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
  #2  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [BUGS] wrong behavior using to_char() - 09-14-2006 , 05:58 PM






Tom Lane wrote:
Quote:
"Euler Taveira de Oliveira" <euler (AT) timbira (DOT) com> writes:
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.

Not unless you have a solution to the problem seen in this thread:
http://archives.postgresql.org/pgsql...2/msg00172.php
I was going to point him to these commits to formatting.c:

date: 2006/02/12 23:48:23; author: momjian; state: Exp; lines: +3 -4
Revert because C locale uses "" for thousands_sep, meaning "n/a", while
French uses "" for "don't want". Seems we have to keep the existing
behavior.
----------------------------
revision 1.105
date: 2006/02/12 19:52:06; author: momjian; state: Exp; lines: +5 -4
Support "" for thousands separator and plus sign in to_char(), per
report from French Debian user. psql already handles "" fine.

One idea would be to handle C locale behavior differently from non-C
locale.

--
Bruce Momjian bruce (AT) momjian (DOT) us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
  #3  
Old   
Peter Eisentraut
 
Posts: n/a

Default Re: [BUGS] wrong behavior using to_char() - 09-14-2006 , 09:13 PM



Bruce Momjian wrote:
Quote:
One idea would be to handle C locale behavior differently from non-C
locale.
Right.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


Reply With Quote
  #4  
Old   
Euler Taveira de Oliveira
 
Posts: n/a

Default Re: [BUGS] wrong behavior using to_char() - 09-14-2006 , 11:11 PM



Jorge Godoy wrote:

Quote:
In the pt_BR locale, the thousand separator is "". So it should return

The thousands separator in pt_BR is ".".

Oh, good catch. There is so much hack in my glibc. :-)


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


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


Reply With Quote
  #5  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [BUGS] wrong behavior using to_char() - 09-15-2006 , 06:13 PM



Peter Eisentraut wrote:
Quote:
Bruce Momjian wrote:
One idea would be to handle C locale behavior differently from non-C
locale.

Right.
I am thinking this is eomthing for 8.3.

--
Bruce Momjian bruce (AT) momjian (DOT) us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #6  
Old   
Jorge Godoy
 
Posts: n/a

Default Re: [BUGS] wrong behavior using to_char() - 09-16-2006 , 07:41 AM



"Euler Taveira de Oliveira" <euler (AT) timbira (DOT) com> writes:

Quote:
In the pt_BR locale, the thousand separator is "". So it should return
The thousands separator in pt_BR is ".".

Quote:
12345,670. Looking at the source, I saw that the test cases for locale
This should be "12.345,670".



--
Jorge Godoy <jgodoy (AT) gmail (DOT) com>

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.