pgsql: Fix psql's code for locale-aware formatting of numeric output.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix psql's code for locale-aware formatting of numeric output.
Date: 2015-09-25 03:01:41
Message-ID: E1ZfJGX-0005lu-UQ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix psql's code for locale-aware formatting of numeric output.

This code did the wrong thing entirely for numbers with an exponent
but no decimal point (e.g., '1e6'), as reported by Jeff Janes in
bug #13636. More generally, it made lots of unverified assumptions
about what the input string could possibly look like. Rearrange so
that it only fools with leading digits that it's directly verified
are there, and an immediately adjacent decimal point. While at it,
get rid of some useless inefficiencies, like converting the grouping
count string to integer over and over (and over).

This has been broken for a long time, so back-patch to all supported
branches.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/7ddadacec4ddea5d0b2e7452ec7adccd015c3bb6

Modified Files
--------------
src/bin/psql/print.c | 103 ++++++++++++++++++++++----------------------------
1 file changed, 45 insertions(+), 58 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-09-25 04:01:33 pgsql: Further fix for psql's code for locale-aware formatting of numer
Previous Message Dean Rasheed 2015-09-24 23:14:59 Re: Rename withCheckOptions to insertedCheckClauses