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

From Bruce Momjian
Subject Re: Why 'infinity' is not in range '[2019-01-02, infinity]'?
Date
Msg-id 20191106042111.GC16353@momjian.us
Whole thread Raw
In response to Re: Why 'infinity' is not in range '[2019-01-02, infinity]'?  (Eugen Konkov <kes-kes@yandex.ru>)
Responses Re: Why 'infinity' is not in range '[2019-01-02, infinity]'?  (Eugen Konkov <kes-kes@yandex.ru>)
List 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
mechanismsare 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@momjian.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

pgsql-docs by date:

Previous
From: PG Doc comments form
Date:
Subject: Adding a Column documentation is misleading
Next
From: Michael Paquier
Date:
Subject: Re: wal_sender_timeout / wal_receiver_timeout - seconds ormilliseconds?