pgsql: Fix daterange canonicalization for +/- infinity.

From: Jeff Davis <jdavis(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix daterange canonicalization for +/- infinity.
Date: 2019-07-19 00:30:46
Message-ID: E1hoGnO-0002IM-75@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix daterange canonicalization for +/- infinity.

The values 'infinity' and '-infinity' are a part of the DATE type
itself, so a bound of the date 'infinity' is not the same as an
unbounded/infinite range. However, it is still wrong to try to
canonicalize such values, because adding or subtracting one has no
effect. Fix by treating 'infinity' and '-infinity' the same as
unbounded ranges for the purposes of canonicalization (but not other
purposes).

Backpatch to all versions because it is inconsistent with the
documented behavior. Note that this could be an incompatibility for
applications relying on the behavior contrary to the documentation.

Author: Laurenz Albe
Reviewed-by: Thomas Munro
Discussion: https://postgr.es/m/77f24ea19ab802bc9bc60ddbb8977ee2d646aec1.camel%40cybertec.at
Backpatch-through: 9.4

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/613eabcd51c3adec50e28c1f151d574db5a05a9e

Modified Files
--------------
src/backend/utils/adt/rangetypes.c | 4 ++--
src/test/regress/expected/rangetypes.out | 24 ++++++++++++++++++++++++
src/test/regress/sql/rangetypes.sql | 4 ++++
3 files changed, 30 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2019-07-19 00:32:19 pgsql: Refactor parallelization processing code in src/bin/scripts/
Previous Message Jeff Davis 2019-07-19 00:09:09 pgsql: Fix error in commit e6feef57.