Re: Division by zero error in to_char(num, '9.9EEEE')

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Division by zero error in to_char(num, '9.9EEEE')
Date: 2021-08-04 07:38:49
Message-ID: CAEZATCUQy-Nr2pY4z9JjwwjJsJz=kHvh7c5Wf0LeG2B8b+bkYw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 30 Jul 2021 at 08:26, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
>
> SELECT to_char(1.2e-1002, '9.9EEEE'); -- fails
> ERROR: division by zero
>
> I think the simplest
> solution is to just introduce a new local function, as in the attached
> patch. This directly constructs 10^n, for integer n, which is pretty
> trivial, and doesn't need any numeric multiplication or rounding.
>

Unless there are any objections, I intend to push this shortly. I
think it's a fairly straightforward bug fix, and I want to be able to
use to_char() in some new numeric regression tests.

Regards,
Dean

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Filip Janus 2021-08-04 07:50:31 Possible dependency issue in makefile
Previous Message Masahiko Sawada 2021-08-04 07:04:39 Re: Failed transaction statistics to measure the logical replication progress