]> granicus.if.org Git - postgresql/commit
Fix daterange canonicalization for +/- infinity.
authorJeff Davis <jdavis@postgresql.org>
Thu, 18 Jul 2019 23:55:59 +0000 (16:55 -0700)
committerJeff Davis <jdavis@postgresql.org>
Thu, 18 Jul 2019 23:55:59 +0000 (16:55 -0700)
commit8af1fccba2b1a46d58fad46ed8d03e8c92fe1152
tree011d80cd51a6943b852611ddfcadfb912f4aaf7e
parenta0c905f23d4c3f7ba647fb69a7e63fd07cdeabe0
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
src/backend/utils/adt/rangetypes.c
src/test/regress/expected/rangetypes.out
src/test/regress/sql/rangetypes.sql