Re: Why 'infinity' is not in range '[2019-01-02, infinity]'?

From: Eugen Konkov <kes-kes(at)yandex(dot)ru>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Why 'infinity' is not in range '[2019-01-02, infinity]'?
Date: 2019-04-29 18:22:16
Message-ID: 1265663903.20190429212216@yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

1.
Also I found next ambiguous part:

select upper_inf( '["2018-08-14","Infinity")'::daterange );

Thanks jstag from IRC for explanation that unbound and infinite are
different essence.

Thus, on the page
https://www.postgresql.org/docs/11/functions-range.html

lower_inf(anyrange) boolean is the lower bound infinite? lower_inf('(,)'::daterange) true
upper_inf(anyrange) boolean is the upper bound infinite? upper_inf('(,)'::daterange) true

should be spelled:

lower_inf(anyrange) boolean is the lower bound unbound? lower_inf('(,)'::daterange) true
upper_inf(anyrange) boolean is the upper bound unbound? upper_inf('(,)'::daterange) true

should not?

2.
I do not know, it where are any sense to distinguish:
[ 2019-01-01, infinity ) and [ 2019-01-01, )

and because: https://www.postgresql.org/docs/11/rangetypes.html#RANGETYPES-INFINITE

This is equivalent to considering that the lower bound is “minus infinity”, or the upper bound is “plus infinity”, respectively

and because of next statement does not work:

select '[2019-01-02,"infinity"]'::daterange @> 'infinity'::date;

if you allow I will suggest to map/convert 'infinity' value to
unbound range, for datatypes which defines 'infinity' value.
so these two become same:

[ 2019-01-01, infinity ) and [ 2019-01-01, )

It seems more consistent in compare to current behavior.

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2019-04-29 21:30:55 Re: Why 'infinity' is not in range '[2019-01-02, infinity]'?
Previous Message Jonathan S. Katz 2019-04-29 17:14:25 Re: Why 'infinity' is not in range '[2019-01-02, infinity]'?