Search Postgresql Archives

Range type bounds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux