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

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Eugen Konkov <kes-kes(at)yandex(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Why 'infinity' is not in range '[2019-01-02, infinity]'?
Date: 2019-11-06 04:21:11
Message-ID: 20191106042111.GC16353@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Sat, Oct 26, 2019 at 04:15:29PM +0300, Eugen Konkov wrote:
> Today I got next ambiguous:
>
> select tstzrange( 'infinity', null );
> tstzrange
> -------------
> [infinity,)
> (1 row)
>
> [DOC](https://www.postgresql.org/docs/12/rangetypes.html) stated:
> >if the upper bound of the range is omitted, then all points greater than the lower bound are included in the range.
> >This is equivalent to considering that the upper bound is “plus infinity”, respectively.
>
> Thus I can write, can not?
>
> select tstzrange( 'infinity', 'infinity' );
> tstzrange
> -------------
> empty
> (1 row)

Well, that makes sense since your start/stop are the same, and there are
no values greater than the infinity you specified.

> But thus it is not not equivalent.
>
>
> >But note that these infinite values are never values of the range's element type, and can never be part of the range
> Thus if 'infinite values are never values of the range' then
>
> “infinity” can not be just another value of any range type
> This conclusion contradicts next doc paragraph:
> >Also, some element types have a notion of “infinity”, but that is just another value so far as the range type mechanisms are concerned.
>
> errr... mechanism of date ranges violates basic rules for 'Infinite
> (Unbounded) Ranges'?

Uh, yeah, those paragraphs need help. You are right that the concept of
infinity in ranges is differnt than the range element type's possible
values of infinity, if it supports it, and the docs are unclear on that.

I have made an attempt at rewriting the paragraphs to clarify the
missing-boundry infinity from the possible range element type's
infinity, and I think I romoved the contradition, and clarified the
description. Patch attached.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

Attachment Content-Type Size
range.diff text/x-diff 3.0 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Michael Paquier 2019-11-06 07:41:10 Re: wal_sender_timeout / wal_receiver_timeout - seconds or milliseconds?
Previous Message PG Doc comments form 2019-11-06 03:24:44 Adding a Column documentation is misleading