public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bruce Momjian <[email protected]>
To: Eugen Konkov <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: Why 'infinity' is not in range '[2019-01-02, infinity]'?
Date: Wed, 6 Nov 2019 08:33:28 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On Wed, Nov  6, 2019 at 12:15:17PM +0200, Eugen Konkov wrote:
> !    Specifying a missing bound as exclusive is automatically converted
> !    to inclusive, e.g., <literal>[,]</literal> is automatically converted
> !    to <literal>(,)</literal>
> 
> Misspell?
> 
> You say:
>    exclusive is automatically converted  to inclusive
> But then:
>    [,] is automatically converted to (,)
> 
> which one is correct?

My mistake.  Thanks for finding that.  Updated patch attached, plus I
improved the second paragraph.

-- 
  Bruce Momjian  <[email protected]>        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 +


Attachments:

  [text/x-diff] range.diff (3.0K, 2-range.diff)
  download | inline diff:
diff --git a/doc/src/sgml/rangetypes.sgml b/doc/src/sgml/rangetypes.sgml
new file mode 100644
index 3a034d9..b75fb3a
*** a/doc/src/sgml/rangetypes.sgml
--- b/doc/src/sgml/rangetypes.sgml
*************** SELECT isempty(numrange(1, 5));
*** 131,159 ****
    <title>Infinite (Unbounded) Ranges</title>
  
    <para>
!    The lower bound of a range can be omitted, meaning that all points less
!    than the upper bound are included in the range. Likewise, if the upper
!    bound of the range is omitted, then all points greater than the lower bound
!    are included in the range. If both lower and upper bounds are omitted, all
!    values of the element type are considered to be in the range.
!   </para>
! 
!   <para>
!    This is equivalent to considering that the lower bound is <quote>minus
!    infinity</quote>, or the upper bound is <quote>plus infinity</quote>,
!    respectively.  But note that these infinite values are never values of
!    the range's element type, and can never be part of the range.  (So there
!    is no such thing as an inclusive infinite bound &mdash; if you try to
!    write one, it will automatically be converted to an exclusive bound.)
    </para>
  
    <para>
!    Also, some element types have a notion of <quote>infinity</quote>, but that
!    is just another value so far as the range type mechanisms are concerned.
!    For example, in timestamp ranges, <literal>[today,]</literal> means the same
!    thing as <literal>[today,)</literal>.  But <literal>[today,infinity]</literal> means
!    something different from <literal>[today,infinity)</literal> &mdash; the latter
!    excludes the special <type>timestamp</type> value <literal>infinity</literal>.
    </para>
  
    <para>
--- 131,156 ----
    <title>Infinite (Unbounded) Ranges</title>
  
    <para>
!    The lower bound of a range can be omitted, meaning that all
!    values less than the upper bound are included in the range, e.g.,
!    <literal>(,3]</literal>. Likewise, if the upper bound of the range
!    is omitted, then all values greater than the lower bound are included
!    in the range. If both lower and upper bounds are omitted, all values
!    of the element type are considered to be in the range.  Specifying a
!    missing bound as inclusive is automatically converted to exclusive,
!    e.g., <literal>[,]</literal> is converted to <literal>(,)</literal>.
!    You can think of these missing values as +/-infinity, but they are
!    special range type values and are considered to be beyond any range
!    element type's +/-infinity values.
    </para>
  
    <para>
!    Element types that have the notion of <quote>infinity</quote> can
!    use them as explicit bound values.  For example, with timestamp
!    ranges, <literal>[today,infinity)</literal> excludes the special
!    <type>timestamp</type> value <literal>infinity</literal>,
!    while <literal>[today,infinity]</literal> include it, as does
!    <literal>[today,)</literal> and <literal>[today,]</literal>.
    </para>
  
    <para>


view thread (9+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Why 'infinity' is not in range '[2019-01-02, infinity]'?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox