Re: [GENERAL] Number format problem

2006-02-06 Thread Daniel Verite
Peter Eisentraut wrote:

> Stéphane SCHILDKNECHT wrote:
> > select to_char(1485.12, '9G999D99');
> 
> > But, surprinsingly, I got 1,1485,12.
> 
> The fr_FR locale is broken.  You should report this to glibc.

On my debian sarge with LC_NUMERIC set to [EMAIL PROTECTED], a
  printf("%'g\n", 1485.12);
produces 1485,12 with which seems to be correct given that the
'thousands_sep' locale entry is set to "" (empty string) and
'decimal_point' to U002C

On the other hand, what postgres produces is:
test=> set lc_numeric='[EMAIL PROTECTED]';
SET
test=> select to_char(1485.12, '9G999D99'); 
  to_char  
---
  1,485,12
(1 row)

which is wrong with regard to thousands_sep="".

In fact, grep'ing the source code reveals that, when 'thousands_sep' is set to
an empty string, it gets ignored and a comma is used instead.
I'm referring to backend/utils/adt/formatting.c, NUM_prepare_locale() in 8.1.2:

  /*
   * Number thousands separator
   */
  if (lconv->thousands_sep && *lconv->thousands_sep)
  Np->L_thousands_sep = lconv->thousands_sep;
  else
  Np->L_thousands_sep = ",";

What's wrong with lconv->thousands_sep being set to an empty string?
Shouldn't it be used nonetheless?

-- 
 Daniel
 PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org


---(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


Re: [GENERAL] Number format problem

2006-02-03 Thread Peter Eisentraut
Stéphane SCHILDKNECHT wrote:
> select to_char(1485.12, '9G999D99');

> But, surprinsingly, I got 1,1485,12.

The fr_FR locale is broken.  You should report this to glibc.

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

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


[GENERAL] Number format problem

2006-02-03 Thread Stéphane SCHILDKNECHT

Hi,

There seems to be some tricky behaviour with number formating and french
locale.

I tried the following request:
select to_char(1485.12, '9G999D99');

I was expecting to get: 1 485,12

But, surprinsingly, I got 1,1485,12.

My postgresql server is an 8.1.2 version. The same problem occurs under
Ubuntu Breezy and Debian Testing.
My current configuration is
[EMAIL PROTECTED]
client_encoding=LATIN9
server_encoding=LATIN9

I tried to reconfigure locales and restart the server, but I can't get
the result I expect.

I really don't know what else I could do.

Sincerely,

--
Stéphane SCHILDKNECHT
Président de PostgreSQLFr
http://www.postgresqlfr.org




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


[GENERAL] Number format problem

2006-02-03 Thread Stéphane SCHILDKNECHT

Hi,

There seems to be some tricky behaviour with number formating ant french 
locale.


i tried the following request:
select to_char(1485.12, '9G999D99');

I was expecting to get: 1 485,12

But, surprinsingly, I got 1,1485,12.

My postgresql server is an 8.1.2 version. The same problem occurs under 
Ubuntu Breezy and Debian Testing.

My current configuration is
[EMAIL PROTECTED]
client_encoding=LATIN9
server_encoding=LATIN9

I tried to reconfigure locales and restart the server, but I can't get 
the result I expect.


I really don't know what else I could do.

Sincerely,

--
Stéphane SCHILDKNECHT
Président de PostgreSQLFr
http://www.postgresqlfr.org



---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings