pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix daterange canonicalization for +/- infinity.
Date: Thu, 18 Jul 2019 20:48:39 +0000
Message-ID: <E1hoDKR-0000eT-Bn@gemulon.postgresql.org> (raw)

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e6feef571a016c9dac52a01aebad484768eb5c68

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(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1hoDKR-0000eT-Bn@gemulon.postgresql.org>
Permalink:  ../E1hoDKR-0000eT-Bn@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hoDKR-0000eT-Bn@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: jdavis@postgresql.org
  Subject: Re: pgsql: Fix daterange canonicalization for +/- infinity.
  In-Reply-To: <E1hoDKR-0000eT-Bn@gemulon.postgresql.org>
  References: <E1hoDKR-0000eT-Bn@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