pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: david@landgren.net
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15675: upper_inf() always returns false for non-null daterange, tstzrange values
Date: Thu, 07 Mar 2019 14:53:19 -0500
Message-ID: <27557.1551988399@sss.pgh.pa.us> (raw)
In-Reply-To: <15675-6a1d056ced2aba10@postgresql.org>
References: <15675-6a1d056ced2aba10@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> I have encountered some counter-intuitive behaviour in upper_inf()

> select
>     upper_inf('["2019-01-01",]'::daterange) as upper_null,
>     upper_inf('["2019-01-01","2019-01-02"]'::daterange) as upper_valid,
>     upper_inf('["2019-01-01",infinity]'::daterange) as upper_infinity;

>  upper_null │ upper_valid │ upper_infinity
> ────────────┼─────────────┼────────────────
>  t          │ f           │ f

> I would have expected ["2019-01-01",infinity] (upper_infinity above) to
> return true as well.

No; this is the intended and documented behavior, per the same
documentation section you quote,
https://www.postgresql.org/docs/current/rangetypes.html#RANGETYPES-INFINITE

As shown in the examples there, a datatype value that happens to be
named "infinity" is just another value so far as the range mechanisms
are concerned, and there's a good reason for it: including or excluding
that value leads to valid but different ranges.

In hindsight, it was probably unwise to use "inf"/"infinite" as the
terminology for ranges; "unbounded" might've been less likely to
provoke confusion with datatypes that have values named "infinity".
But we're stuck with that naming now.

			regards, tom lane




view thread (2+ messages)

Message-ID: <27557.1551988399@sss.pgh.pa.us>
Permalink:  ../27557.1551988399@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/27557.1551988399@sss.pgh.pa.us

 · 

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david@landgren.net
  Subject: Re: BUG #15675: upper_inf() always returns false for non-null daterange, tstzrange values
  In-Reply-To: <27557.1551988399@sss.pgh.pa.us>
  References: <15675-6a1d056ced2aba10@postgresql.org> <27557.1551988399@sss.pgh.pa.us>

* 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