Re: pgsql: Further fix for psql's code for locale-aware formatting of numer

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Further fix for psql's code for locale-aware formatting of numer
Date: 2015-10-05 01:57:52
Message-ID: 20151005015752.GA25308@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers


Offlist, I think it was this commit:

commit 73a7c322c36bb96d4e2d053ff245b0f7b99f09e0
Author: Bruce Momjian <bruce(at)momjian(dot)us>
Date: Sun Jul 10 03:46:13 2005 +0000

Add psql \pset numericsep to allow output numbers like 100,000.0 or
100.000,0.

Eugen Nedelcu

which I later wacked around too:

commit 45a19efa9ec66fa35cc86671e2a1cebfe787fd9f
Author: Bruce Momjian <bruce(at)momjian(dot)us>
Date: Thu Jul 14 08:42:37 2005 +0000

Change numericsep to a boolean, and make it locale-aware.

commit bd157821649ae203b9c8ce8daf4ec027a0003351
Author: Bruce Momjian <bruce(at)momjian(dot)us>
Date: Thu Jul 14 21:12:41 2005 +0000

Enable multi-byte thousands_sep and decimal_point for numericsep.

commit 507465525e8c3e4ebf0159ac07c915dd609cd6b3
Author: Bruce Momjian <bruce(at)momjian(dot)us>
Date: Mon Jul 18 20:57:53 2005 +0000

\pset numericsep -> numericlocale.

commit 8ddd22f2456af0155f9c183894f481203e86b76e
Author: Bruce Momjian <bruce(at)momjian(dot)us>
Date: Tue Sep 27 16:30:25 2005 +0000

Fix incorrect psql \x memory allocation for numericlocale. Redesign API
to be less error-prone.

Obviously this was all a very long time ago.

---------------------------------------------------------------------------

On Fri, Sep 25, 2015 at 04:01:33AM +0000, Tom Lane wrote:
> Further fix for psql's code for locale-aware formatting of numeric output.
>
> On closer inspection, those seemingly redundant atoi() calls were not so
> much inefficient as just plain wrong: the author of this code either had
> not read, or had not understood, the POSIX specification for localeconv().
> The grouping field is *not* a textual digit string but separate integers
> encoded as chars.
>
> We'll follow the existing code as well as the backend's cash.c in only
> honoring the first group width, but let's at least honor it correctly.
>
> This doesn't actually result in any behavioral change in any of the
> locales I have installed on my Linux box, which may explain why nobody's
> complained; grouping width 3 is close enough to universal that it's barely
> worth considering other cases. Still, wrong is wrong, so back-patch.
>
> Branch
> ------
> master
>
> Details
> -------
> http://git.postgresql.org/pg/commitdiff/6325527d845b629243fb3f605af6747a7a4ac45f
>
> Modified Files
> --------------
> src/bin/psql/print.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
>
> --
> Sent via pgsql-committers mailing list (pgsql-committers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-committers

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Roman grave inscription +

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2015-10-05 02:15:07 Re: pgsql: Further fix for psql's code for locale-aware formatting of numer
Previous Message Stephen Frost 2015-10-05 01:05:56 pgsql: ALTER TABLE .. FORCE ROW LEVEL SECURITY