]> granicus.if.org Git - postgresql/commit
Further fix for psql's code for locale-aware formatting of numeric output.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 25 Sep 2015 04:00:33 +0000 (00:00 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 25 Sep 2015 04:00:43 +0000 (00:00 -0400)
commitda4af91cefaabe493577f1d6d17ee78f2e66389c
tree6a97eefaf21d656e2004a0848e95c16186740573
parentf1ee153dcf1a3bd64889f56bee6a863f54e97d99
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.
src/bin/psql/print.c