From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Infinities in type numeric
Date: Fri, 12 Jun 2020 14:14:43 -0400
Message-ID: <774767.1591985683@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoaRuq_Q6Xcgn+PyLDs=v87zbs20Wx_1E23Xpi=WJhB6Sw@mail.gmail.com>
References: <606717.1591924582@sss.pgh.pa.us>
<CA+TgmoaE3zuGc0L0c-XZ-6BYR1kY=Eqy4bTDvc1m+sHVAdt6jg@mail.gmail.com>
<702941.1591981259@sss.pgh.pa.us>
<CA+TgmoaRuq_Q6Xcgn+PyLDs=v87zbs20Wx_1E23Xpi=WJhB6Sw@mail.gmail.com>
Robert Haas <robertmhaas@gmail.com> writes:
> 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?
Hm, would there be any real use-case?
An implementation issue is that even in the "long" numeric format,
we cram dscale into a 14-bit unsigned field. You could redefine
the field as signed and pray that nobody has dscales above 8K
stored on disk, but I'm dubious that there's a good argument for
taking that risk.
There might be algorithmic issues as well, haven't really looked.
Any such problems would probably be soluble, if need be by forcing
the scale to be at least 0 for calculation and then rounding
afterwards.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com
Subject: Re: Infinities in type numeric
In-Reply-To: <774767.1591985683@sss.pgh.pa.us>
References: <606717.1591924582@sss.pgh.pa.us> <CA+TgmoaE3zuGc0L0c-XZ-6BYR1kY=Eqy4bTDvc1m+sHVAdt6jg@mail.gmail.com> <702941.1591981259@sss.pgh.pa.us> <CA+TgmoaRuq_Q6Xcgn+PyLDs=v87zbs20Wx_1E23Xpi=WJhB6Sw@mail.gmail.com> <774767.1591985683@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox