pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Further fix for psql's code for locale-aware formatting of numer
Date: Fri, 25 Sep 2015 04:01:33 +0000
Message-ID: <E1ZfKCT-0006k4-5f@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (16+ messages)  latest in thread

Message-ID: <E1ZfKCT-0006k4-5f@gemulon.postgresql.org>
Permalink:  ../E1ZfKCT-0006k4-5f@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ZfKCT-0006k4-5f@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Further fix for psql's code for locale-aware formatting of numer
  In-Reply-To: <E1ZfKCT-0006k4-5f@gemulon.postgresql.org>
  References: <E1ZfKCT-0006k4-5f@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox