diff options
author | Bruce Momjian | 2019-12-27 19:33:30 +0000 |
---|---|---|
committer | Bruce Momjian | 2019-12-27 19:33:30 +0000 |
commit | 820b1d1a48afca43bf3a1ff45b36ef0ded55dfff (patch) | |
tree | c6f2dd6d1119340eb95cd43e20cffd3bfed6ff58 | |
parent | 898e0c650097a724177ade1af552901385eaf6c1 (diff) |
docs: clarify infinite range values from data-type infinities
The previous docs referenced these distinct ideas confusingly.
Reported-by: Eugen Konkov
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 9.4
-rw-r--r-- | doc/src/sgml/rangetypes.sgml | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/doc/src/sgml/rangetypes.sgml b/doc/src/sgml/rangetypes.sgml index d1125618b4..ce626a5ff3 100644 --- a/doc/src/sgml/rangetypes.sgml +++ b/doc/src/sgml/rangetypes.sgml @@ -131,29 +131,26 @@ SELECT isempty(numrange(1, 5)); <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. + 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]</>. 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>[,]</> is converted to <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> - 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 — 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</>, but that - is just another value so far as the range type mechanisms are concerned. - For example, in timestamp ranges, <literal>[today,]</> means the same - thing as <literal>[today,)</>. But <literal>[today,infinity]</> means - something different from <literal>[today,infinity)</> — the latter - excludes the special <type>timestamp</> value <literal>infinity</>. + 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)</> excludes the special + <type>timestamp</type> value <literal>infinity</>, + while <literal>[today,infinity]</> include it, as does + <literal>[today,)</> and <literal>[today,]</>. </para> <para> |