Re: Infinities in type numeric - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Infinities in type numeric
Date
Msg-id CA+TgmoaRuq_Q6Xcgn+PyLDs=v87zbs20Wx_1E23Xpi=WJhB6Sw@mail.gmail.com
Whole thread Raw
In response to Re: Infinities in type numeric  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Infinities in type numeric  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, Jun 12, 2020 at 1:01 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> This does tie into something I have a question about in the patch's
> comments though.  As the patch stands, numeric(numeric, integer)
> (that is, the typmod-enforcement function) just lets infinities
> through regardless of the typmod, on the grounds that it is/was also
> letting NaNs through regardless of typmod.  But you could certainly
> make the argument that Inf should only be allowed in an unconstrained
> numeric column, because by definition it overflows any finite precision
> restriction.  If we did that, you'd never see Inf in a
> standard-conforming column, since SQL doesn't allow unconstrained
> numeric columns IIRC.  That'd at least ameliorate your concern.

Yes, I agree. It also seems like a more principled choice - I am not
sure why if I ask for a number no larger than 10^3 we ought to permit
infinity.

BTW, has there been any thought to supporting a negative scale for the
numeric data type? If you can cut off digits after the decimal, why
not before?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Internal key management system
Next
From: Robert Haas
Date:
Subject: Re: Parallel Seq Scan vs kernel read ahead