On Thu, Nov 2, 2023 at 08:56:13AM +0100, Laurenz Albe wrote:
> On Wed, 2023-11-01 at 18:03 -0400, Bruce Momjian wrote:
> > On Wed, Nov 1, 2023 at 09:40:43PM +0100, Laurenz Albe wrote:
> > > > Yes, I agree this documentation needs help.
> > > >
> > > > For upper/lower(), it is clear that the documentation is better saying
> > > > "unspecified" rather than infinite. The fact that upper/lower_inf()
> > > > returns false for +/-Infinity is quite odd, but should at least be
> > > > documented.
> > > >
> > > > Patch attached. It is odd that +Infinity (vs. Infinity) wasn't
> > > > supported for datetime input until PG 16, but I think we have to say
> > > > +/-infinity vs (blank)/-Infinity.
> > > >
> > > > Patch attached.
> > >
> > > I am unhappy with "unspecified". A NULL value as upper or lower bound
> > > has a very
> > > specific meaning, namely that the range is unbounded in that direction.
> > > This is
> > > a bit confusing, since NULL is typically used for unknown or undefined
> > > values.
> > >
> > > I think it would be better to say "returns NULL if the range is empty or
> > > unbounded"
> > > and "is the range unbounded on the upper end?".
> >
> > I had to go with "Is the multirange's lower bound unbounded?" because
> > the surrounding items use that sentence structure. Patch attached.
>
> Better, though "Is the range's upper bound unbounded?" makes me cringe.
Oh, yeah, totally cringe, me too. :-)
> It is not the bound that is bounded or not, but the range.
>
> How about "Is the range unbounded at the upper end?" or "Does the range
> have no upper bound?"
I used your "end" idea to modify the patch, attached.
--
Bruce Momjian <[email protected]> https://momjian.us
EDB https://enterprisedb.com
Only you can decide what is important to you.
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index c76ec52c55..c2f266ea24 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -19905,7 +19905,7 @@ SELECT NULLIF(value, '(none)') ...
</para>
<para>
Extracts the lower bound of the range (<literal>NULL</literal> if the
- range is empty or the lower bound is infinite).
+ range is empty or unbounded).
</para>
<para>
<literal>lower(numrange(1.1,2.2))</literal>
@@ -19923,7 +19923,7 @@ SELECT NULLIF(value, '(none)') ...
</para>
<para>
Extracts the upper bound of the range (<literal>NULL</literal> if the
- range is empty or the upper bound is infinite).
+ range is empty or unbounded).
</para>
<para>
<literal>upper(numrange(1.1,2.2))</literal>
@@ -19991,7 +19991,8 @@ SELECT NULLIF(value, '(none)') ...
<returnvalue>boolean</returnvalue>
</para>
<para>
- Is the range's lower bound infinite?
+ Is the range's lower end unbounded? A +/-Infinity lower
+ bound returns false.
</para>
<para>
<literal>lower_inf('(,)'::daterange)</literal>
@@ -20008,7 +20009,8 @@ SELECT NULLIF(value, '(none)') ...
<returnvalue>boolean</returnvalue>
</para>
<para>
- Is the range's upper bound infinite?
+ Is the range's upper end unbounded? A +/-Infinity upper
+ bound returns false.
</para>
<para>
<literal>upper_inf('(,)'::daterange)</literal>
@@ -20063,7 +20065,7 @@ SELECT NULLIF(value, '(none)') ...
</para>
<para>
Extracts the lower bound of the multirange (<literal>NULL</literal> if the
- multirange is empty or the lower bound is infinite).
+ multirange is empty or unbounded).
</para>
<para>
<literal>lower('{[1.1,2.2)}'::nummultirange)</literal>
@@ -20081,7 +20083,7 @@ SELECT NULLIF(value, '(none)') ...
</para>
<para>
Extracts the upper bound of the multirange (<literal>NULL</literal> if the
- multirange is empty or the upper bound is infinite).
+ multirange is empty or unbounded).
</para>
<para>
<literal>upper('{[1.1,2.2)}'::nummultirange)</literal>
@@ -20149,7 +20151,8 @@ SELECT NULLIF(value, '(none)') ...
<returnvalue>boolean</returnvalue>
</para>
<para>
- Is the multirange's lower bound infinite?
+ Is the multirange's lower end unbounded? A +/-Infinity lower
+ bound returns false.
</para>
<para>
<literal>lower_inf('{(,)}'::datemultirange)</literal>
@@ -20166,7 +20169,8 @@ SELECT NULLIF(value, '(none)') ...
<returnvalue>boolean</returnvalue>
</para>
<para>
- Is the multirange's upper bound infinite?
+ Is the multirange's upper end unbounded? A +/-Infinity upper
+ bound returns false.
</para>
<para>
<literal>upper_inf('{(,)}'::datemultirange)</literal>