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/376945611.20191026161529@yandex.ru

Backpatch-through: 9.4
This commit is contained in:
Bruce Momjian 2019-12-27 14:33:30 -05:00
parent 1dd88201ad
commit 5d72f85d4c

View File

@ -131,29 +131,26 @@ SELECT isempty(numrange(1, 5));
<title>Infinite (Unbounded) Ranges</title> <title>Infinite (Unbounded) Ranges</title>
<para> <para>
The lower bound of a range can be omitted, meaning that all points less The lower bound of a range can be omitted, meaning that all
than the upper bound are included in the range. Likewise, if the upper values less than the upper bound are included in the range, e.g.,
bound of the range is omitted, then all points greater than the lower bound <literal>(,3]</literal>. Likewise, if the upper bound of the range
are included in the range. If both lower and upper bounds are omitted, all is omitted, then all values greater than the lower bound are included
values of the element type are considered to be in the range. 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>
<para> <para>
This is equivalent to considering that the lower bound is <quote>minus Element types that have the notion of <quote>infinity</quote> can
infinity</quote>, or the upper bound is <quote>plus infinity</quote>, use them as explicit bound values. For example, with timestamp
respectively. But note that these infinite values are never values of ranges, <literal>[today,infinity)</literal> excludes the special
the range's element type, and can never be part of the range. (So there <type>timestamp</type> value <literal>infinity</literal>,
is no such thing as an inclusive infinite bound &mdash; if you try to while <literal>[today,infinity]</literal> include it, as does
write one, it will automatically be converted to an exclusive bound.) <literal>[today,)</literal> and <literal>[today,]</literal>.
</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>
<para> <para>