Re: [PATCHES] thousands comma numeric formatting in psql

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, Eugen Nedelcu <eugen(at)sifolt(dot)ro>
Subject: Re: [PATCHES] thousands comma numeric formatting in psql
Date: 2005-07-12 14:48:40
Message-ID: 200507121448.j6CEmeR17738@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Peter Eisentraut wrote:
> Am Dienstag, 12. Juli 2005 05:29 schrieb Bruce Momjian:
> > > Bruce Momjian wrote:
> > > > I have heavily modified your patch and have applied it. Instead of
> > > > using langinfo, I used a \pset variable numericsep.
>
> > Because I don't have langinfo on my system, so I can't test it, nor add
> > configure code for it. It also prevents us from using space as the
> > separator, which is the international standard.
>
> OK, so let's discuss what we really want here.
>
> The original submitter wanted locale-dependent output, which seems reasonable,
> because that's what locale settings are intended for.

True, but there were no locale configure tests, and I don't have
langinfo, so I just made it a \pset 'string' variable. Also, when I
learned that the international system uses a space to separate
trigroups, a separate setting seemed best:

http://en.wikipedia.org/wiki/Comma_%28punctuation%29#Numbers

One thing we could do is to have a special value like 'locale' that uses
langinfo, and all other values are taken literally.

> The current state allows users to manually set the format, or actually only
> one aspect of the format? Where can you set the decimal separator and the
> size of the grouping (3 digits or 4 digits)? Is this capability even useful
> to get localized behavior?

You can't change the grouping from three, and the decimal is only be
changed by setting the numeric separator to a period. We could add a
new \pset for the decimal mark, but then do we auto-set it when the
separator is a period?

> My other concern is that if we allow manual specification of the output format
> of some data type, then eventually someone will want to specify the format of
> some other data type as well, such as the date/time types. We should think
> about whether we want to be consistent here.

We do allow MDY and DMY specification, but that controls both input and
output in the server, while this just controls psql display. It is a
good question how other settings should be handled, but I don't know the
answers. Anyone?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-07-12 15:23:21 Re: [PATCHES] thousands comma numeric formatting in psql
Previous Message Tom Lane 2005-07-12 14:26:51 Re: Where is the decision about placement of new tuple made ?

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-07-12 15:23:21 Re: [PATCHES] thousands comma numeric formatting in psql
Previous Message Michael Fuhr 2005-07-12 13:04:52 PL/Perl list value return causes segfault