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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Further fix for psql's code for locale-aware formatting of numer
Date: 2015-09-25 04:01:33
Message-ID: E1ZfKCT-0006k4-5f@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Jan Wieck 2015-09-25 14:20:30 Re: [COMMITTERS] pgsql: Fix an O(N^2) problem in foreign key references.
Previous Message Tom Lane 2015-09-25 03:01:41 pgsql: Fix psql's code for locale-aware formatting of numeric output.