]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix numeric width_bucket() to allow its first argument to be infinite.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 8 Oct 2020 16:37:59 +0000 (12:37 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 8 Oct 2020 16:37:59 +0000 (12:37 -0400)
commit8ce423b1912b8303dbec5dc3ec78a7a725acf6c2
tree0dd96189eec828d01611dda11c5a98712a810ffc
parentb90b79e1409b7cbffcadf89ae2e85c7ba1332818
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
src/backend/utils/adt/numeric.c
src/test/regress/expected/numeric.out
src/test/regress/sql/numeric.sql