Thread: Re: [GENERAL] Number format problem

Re: [GENERAL] Number format problem

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tom Lane wrote:
>> This patch broke the regression tests.  It seems to change the C-locale
>> behavior on many platforms.

> Oh, so C locale has "" for thousands_sep?  Hmm.  So there is no way to
> disinguish "" as "don't have" from "" as "don't want".  Will revert.

Possibly we could special-case C locale, and allow an empty string only
when not C locale.  However, it could be that there are other locales
where the change would surprise people, too :-(

            regards, tom lane

Re: [GENERAL] Number format problem

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> This patch broke the regression tests.  It seems to change the C-locale
> >> behavior on many platforms.
>
> > Oh, so C locale has "" for thousands_sep?  Hmm.  So there is no way to
> > disinguish "" as "don't have" from "" as "don't want".  Will revert.
>
> Possibly we could special-case C locale, and allow an empty string only
> when not C locale.  However, it could be that there are other locales
> where the change would surprise people, too :-(

Not sure.  Peter stated the French locale was wrong for the Debian they
were using, and he should know, so I am going to wait for  more feeback.

One thing that has me confused is that psql/print.c doesn't check for a
zero-length string for thousands_sep in setDecimalLocale, so I am not
thinking that is wrong and should skip "" like we do in formatting.c.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: [GENERAL] Number format problem

From
"Daniel Verite"
Date:
    Bruce Momjian wrote:

> > > Oh, so C locale has "" for thousands_sep?  Hmm.  So there is no way to
> > > disinguish "" as "don't have" from "" as "don't want".  Will revert.
> >
> > Possibly we could special-case C locale, and allow an empty string only
> > when not C locale.  However, it could be that there are other locales
> > where the change would surprise people, too :-(
>
> Not sure.  Peter stated the French locale was wrong for the Debian they
> were using, and he should know, so I am going to wait for  more feeback.

The baseline glibc sources from gnu.org have
(in glibc-2.3.6/localedata/locales/fr_FR):

LC_NUMERIC
decimal_point             "<U002C>"
thousands_sep             ""
grouping                  0;0
END LC_NUMERIC

So at first sight it's more a glibc issue rather than debian-specific.

However, this was filed as a bug in debian long ago. Incidentally, it got fixed
just this week, meaning that the future debian-glibc should use a space instead
of the empty string, as reported here:
http://lists.debian.org/debian-glibc/2006/02/msg00168.html
Which is consistent with Peter's statement that it was wrong up to now, and also
with what the OP expected in the first place.

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


Re: [GENERAL] Number format problem

From
Bruce Momjian
Date:
Daniel Verite wrote:
>     Bruce Momjian wrote:
>
> > > > Oh, so C locale has "" for thousands_sep?  Hmm.  So there is no way to
> > > > disinguish "" as "don't have" from "" as "don't want".  Will revert.
> > >
> > > Possibly we could special-case C locale, and allow an empty string only
> > > when not C locale.  However, it could be that there are other locales
> > > where the change would surprise people, too :-(
> >
> > Not sure.  Peter stated the French locale was wrong for the Debian they
> > were using, and he should know, so I am going to wait for  more feeback.
>
> The baseline glibc sources from gnu.org have
> (in glibc-2.3.6/localedata/locales/fr_FR):
>
> LC_NUMERIC
> decimal_point             "<U002C>"
> thousands_sep             ""
> grouping                  0;0
> END LC_NUMERIC
>
> So at first sight it's more a glibc issue rather than debian-specific.
>
> However, this was filed as a bug in debian long ago. Incidentally, it got fixed
> just this week, meaning that the future debian-glibc should use a space instead
> of the empty string, as reported here:
> http://lists.debian.org/debian-glibc/2006/02/msg00168.html
> Which is consistent with Peter's statement that it was wrong up to now, and also
> with what the OP expected in the first place.

Oh, good.  I looked and now realize that psql is already checking for a
non-"" string:

        if (*extlconv->thousands_sep)

so we are consistent.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073