Range type bounds - Mailing list pgsql-general

From Adrian Klaver
Subject Range type bounds
Date
Msg-id 54761F6E.6010900@aklaver.com
Whole thread Raw
Responses Re: Range type bounds
List pgsql-general
I am trying out the range types:

http://www.postgresql.org/docs/9.3/interactive/rangetypes.html

and got confused by the documentation wording for specifying no lower or
upper bound:

"The lower-bound may be either a string that is valid input for the
subtype, or empty to indicate no lower bound. Likewise, upper-bound may
be either a string that is valid input for the subtype, or empty to
indicate no upper bound."

What I saw was this:

aklaver@test=> select daterange('2014-11-01'::date,) ;
ERROR:  syntax error at or near ")"
LINE 1: select daterange('2014-11-01'::date,) ;

aklaver@test=> select '[2014-11-01,)'::daterange;
    daterange
---------------
  [2014-11-01,)
(1 row)

aklaver@test=> select daterange('2014-11-01'::date, Null) ;
    daterange
---------------
  [2014-11-01,)
(1 row)

which when I got further into the docs was shown in this example:

8.17.6. Constructing Ranges

-- Using NULL for either bound causes the range to be unbounded on that
side.
SELECT numrange(NULL, 2.2);


I will leave it to philosophers to decide whether NULL is empty, but it
seems the documentation could be more explicit on what constitutes empty
in the text versus constructor method of creating a range.

Thanks,
--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Active/Active clustering in postgres
Next
From: Dev Kumkar
Date:
Subject: Re: Lock Management: Waiting on locks