Re: BUG #13636: psql numericlocale adds comma where it ought not

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13636: psql numericlocale adds comma where it ought not
Date: 2015-09-25 02:19:11
Message-ID: 27190.1443147551@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> writes:
> On Fri, Sep 25, 2015 at 11:37 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Indeed. It looks like the author of format_numeric_locale() never
>> heard of e-format output. There's some other pretty crummy code in
>> there, but that's the core problem ...

> Does this look reasonable?

I thought it needed a rather more thoroughgoing revision: there is no need
for it to assume so much about what is in the column, and good reason for
it not to. (For instance, I note that psql will try to apply this code to
"money" columns, which may be a bad idea, but there can definitely be
stuff in there that doesn't look like a regular number.) It should muck
with digits immediately following the sign, and nothing else. There was
some other useless inefficiency too. I came up with the attached.

I would have borrowed your regression test additions, except I'm afraid
they will fail if the prevailing locale isn't C.

regards, tom lane

Attachment Content-Type Size
numeric-locale-fixes.patch text/x-diff 6.0 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2015-09-25 03:33:04 Re: BUG #13636: psql numericlocale adds comma where it ought not
Previous Message aaron 2015-09-25 02:06:58 BUG #13637: ~2 GB psql import fails with out of memory error on machine with 64 GB RAM