Re: BUG #15434: NUMERIC without any precision or scale truncates scale to 16 digits

From: Andrey <parihaaraka(at)gmail(dot)com>
To: andrew(at)tao11(dot)riddles(dot)org(dot)uk
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15434: NUMERIC without any precision or scale truncates scale to 16 digits
Date: 2018-10-16 12:25:18
Message-ID: CAOYf6ecjuc7twZ6xTdb1Q2VxXVmb-SYhCrxvM3C+W=VpfKtnqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

вт, 16 окт. 2018 г. в 14:30, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>:

> >>>>> "PG" == PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
>
> PG> 1800000000000000001::numeric / (10^18)::numeric truncated, --
> PG> truncates to 16 digits after decimal point
>
> It has to truncate it _somewhere_, because otherwise 1::numeric / 3
> would be infinitely long...
>
> The choice that numeric division actually makes is to produce a result
> with at least 16 significant figures, but also with at least as many
> decimal places as the display scale of either of the inputs.
>
> --
> Andrew (irc:RhodiumToad)
>

It looks like precision does matters.
man: "...up to the implementation limit on precision".
Why we don't want to decrease scale, but we decrease precision without any
problems?

Regards,
Andrey L

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2018-10-17 06:18:40 BUG #15435: Infinite-recursive SQL procedure can crash a database server
Previous Message Andrew Gierth 2018-10-16 11:30:44 Re: BUG #15434: NUMERIC without any precision or scale truncates scale to 16 digits