Skip to content

Commit 820b1d1

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/376945611.20191026161529@yandex.ru Backpatch-through: 9.4
1 parent 898e0c6 commit 820b1d1

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]</>. 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>[,]</> is converted to <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</>, but that
152-
is just another value so far as the range type mechanisms are concerned.
153-
For example, in timestamp ranges, <literal>[today,]</> means the same
154-
thing as <literal>[today,)</>. But <literal>[today,infinity]</> means
155-
something different from <literal>[today,infinity)</> &mdash; the latter
156-
excludes the special <type>timestamp</> value <literal>infinity</>.
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)</> excludes the special
151+
<type>timestamp</type> value <literal>infinity</>,
152+
while <literal>[today,infinity]</> include it, as does
153+
<literal>[today,)</> and <literal>[today,]</>.
157154
</para>
158155

159156
<para>

0 commit comments

Comments
 (0)