Skip to content

Commit 650692a

Browse files
committed
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
1 parent a052f6c commit 650692a

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

doc/src/sgml/rangetypes.sgml

+17-20
Original file line numberDiff line numberDiff line change
@@ -131,29 +131,26 @@ SELECT isempty(numrange(1, 5));
131131
<title>Infinite (Unbounded) Ranges</title>
132132

133133
<para>
134-
The lower bound of a range can be omitted, meaning that all points less
135-
than the upper bound are included in the range. Likewise, if the upper
136-
bound of the range is omitted, then all points greater than the lower bound
137-
are included in the range. If both lower and upper bounds are omitted, all
138-
values of the element type are considered to be in the range.
134+
The lower bound of a range can be omitted, meaning that all
135+
values less than the upper bound are included in the range, e.g.,
136+
<literal>(,3]</literal>. Likewise, if the upper bound of the range
137+
is omitted, then all values greater than the lower bound are included
138+
in the range. If both lower and upper bounds are omitted, all values
139+
of the element type are considered to be in the range. Specifying a
140+
missing bound as inclusive is automatically converted to exclusive,
141+
e.g., <literal>[,]</literal> is converted to <literal>(,)</literal>.
142+
You can think of these missing values as +/-infinity, but they are
143+
special range type values and are considered to be beyond any range
144+
element type's +/-infinity values.
139145
</para>
140146

141147
<para>
142-
This is equivalent to considering that the lower bound is <quote>minus
143-
infinity</quote>, or the upper bound is <quote>plus infinity</quote>,
144-
respectively. But note that these infinite values are never values of
145-
the range's element type, and can never be part of the range. (So there
146-
is no such thing as an inclusive infinite bound &mdash; if you try to
147-
write one, it will automatically be converted to an exclusive bound.)
148-
</para>
149-
150-
<para>
151-
Also, some element types have a notion of <quote>infinity</quote>, but that
152-
is just another value so far as the range type mechanisms are concerned.
153-
For example, in timestamp ranges, <literal>[today,]</literal> means the same
154-
thing as <literal>[today,)</literal>. But <literal>[today,infinity]</literal> means
155-
something different from <literal>[today,infinity)</literal> &mdash; the latter
156-
excludes the special <type>timestamp</type> value <literal>infinity</literal>.
148+
Element types that have the notion of <quote>infinity</quote> can
149+
use them as explicit bound values. For example, with timestamp
150+
ranges, <literal>[today,infinity)</literal> excludes the special
151+
<type>timestamp</type> value <literal>infinity</literal>,
152+
while <literal>[today,infinity]</literal> include it, as does
153+
<literal>[today,)</literal> and <literal>[today,]</literal>.
157154
</para>
158155

159156
<para>

0 commit comments

Comments
 (0)