From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Eugen Nedelcu <eugen(at)sifolt(dot)ro> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: thousands comma numeric formatting in psql |
Date: | 2005-07-10 03:46:37 |
Message-ID: | 200507100346.j6A3kb812714@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Eugen Nedelcu wrote:
> Hello,
>
> I have included my patch attached to this mail.
>
> I have made the changes to deal with locale settings from client
> environment. So now you can start psql like this:
>
> (export LC_ALL=ro_RO; psql -U user db)
>
> and have numeric formatting with '.' as thousands separator and
> ',' as decimal point, or
>
> (export LC_ALL=en_US; psql -U user db)
>
> and have numeric formatting with ',' as thousands separator and
> '.' as decimal point. This formatting is default when locale is 'C'
>
> You can set any locale and numeric formatting code will take it in
> consideration.
>
> This patch is for version 7.3.2. The steps for install is:
>
> 1) cp thousands_comma.diff $POSTGRES_DIR/src/bin/psql
> 2) cd $POSTGRES_DIR/src/bin/psql
> 3) patch -p0 < thousands_comma.diff
> 4) ../../../configure && make
I have heavily modified your patch and have applied it. Instead of
using langinfo, I used a \pset variable numericsep. (We can talk about
adding langinfo detection later.) By default, it is off, ''. If you
set it to '.', the decimal marker will be ','. This also allows
separators like ' ' too so numebers can appear as 100 000.
I have also added documentation.
--
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
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 25.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Márcio A. Sepp | 2005-07-10 07:26:26 | Hide source code |
Previous Message | Stephen Frost | 2005-07-10 00:29:56 | Re: another roles related question |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2005-07-10 03:53:24 | Re: [patch 1/2] Add implementation of SHA256/384/512 |
Previous Message | Ilia Kantor | 2005-07-09 18:02:24 | A minor patch to mark xml/xslt functions immutable |