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

From Tom Lane
Subject pgsql: Fix psql's code for locale-aware formatting of numeric output.
Date
Msg-id E1ZfJGX-0005lo-U0@gemulon.postgresql.org
Whole thread Raw
List 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_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/348dd2847fa4a379e452ee00ab2016ec1629202d

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


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix psql's code for locale-aware formatting of numeric output.
Next
From: Tom Lane
Date:
Subject: pgsql: Further fix for psql's code for locale-aware formatting of numer