pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix numeric width_bucket() to allow its first argument to be inf
Date: Thu, 08 Oct 2020 17:06:40 +0000
Message-ID: <E1kQZNI-0001nL-GE@gemulon.postgresql.org> (raw)

Fix numeric width_bucket() to allow its first argument to be infinite.

While the calculation is not well-defined if the bounds arguments are
infinite, there is a perfectly sane outcome if the test operand is
infinite: it's just like any other value that's before the first bucket
or after the last one.  width_bucket_float8() got this right, but
I was too hasty about the case when adding infinities to numerics
(commit a57d312a7), so that width_bucket_numeric() just rejected it.
Fix that, and sync the relevant error message strings.

No back-patch needed, since infinities-in-numeric haven't shipped yet.

Discussion: https://postgr.es/m/2465409.1602170063@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8ce423b1912b8303dbec5dc3ec78a7a725acf6c2

Modified Files
--------------
src/backend/utils/adt/numeric.c       |  5 +++--
src/test/regress/expected/numeric.out | 17 +++++++++++++----
src/test/regress/sql/numeric.sql      |  7 +++++--
3 files changed, 21 insertions(+), 8 deletions(-)



Message-ID: <E1kQZNI-0001nL-GE@gemulon.postgresql.org>
Permalink:  ../E1kQZNI-0001nL-GE@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kQZNI-0001nL-GE@gemulon.postgresql.org

 · 

reply

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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix numeric width_bucket() to allow its first argument to be inf
  In-Reply-To: <E1kQZNI-0001nL-GE@gemulon.postgresql.org>
  References: <E1kQZNI-0001nL-GE@gemulon.postgresql.org>

* 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