Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qyYTa-0098kh-7a for pgsql-docs@arkaria.postgresql.org; Thu, 02 Nov 2023 14:15:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qyYTY-00DSj8-H5 for pgsql-docs@arkaria.postgresql.org; Thu, 02 Nov 2023 14:15:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qyYTY-00DSj0-9j for pgsql-docs@lists.postgresql.org; Thu, 02 Nov 2023 14:15:12 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qyYTR-004KvW-6u for pgsql-docs@lists.postgresql.org; Thu, 02 Nov 2023 14:15:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2023062407; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=jvp+nMEFYQOw+8JLvdekfrd1Lopzr9yKL5gdVgxVTKc=; b=dIZ6r XKurC44Mw1k5un/XqrxAG8M+kSxKYeu6CTUgLZ6X5NVoFJ0lY76jNwrJTKATDbmFIvcur8C5W1hiY omBaMNk/vr9DuOCFYxmiIaFk6Z1xPQsF3L0yfLGRF47qwhhQpvvqNN36+pJjn7jrJ51ITuQpWoYLi kPfaGuvenTO/oYvmOeSFF3cTZoT0ENqhG7c0SYFqt8gPOy/DWJNOWbE0+ZIJrHeYeiiaOdP9qgVo9 90zd3jEwPED2VBJPibScn8NRuDELSIA/szhE9gDZEG1ev91TC7+mZ3BXzT7YFJaAkM8r9qBIcVfGL l33X3SEIq/hdzh6VhrXYemm7PCh+A==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1qyYTK-00CD0A-2W; Thu, 02 Nov 2023 10:14:58 -0400 Date: Thu, 2 Nov 2023 10:14:58 -0400 From: Bruce Momjian To: Laurenz Albe Cc: Fujii Masao , jani.rahkola@iki.fi, pgsql-docs@lists.postgresql.org Subject: Re: Documentation of return values of range functions lower and upper Message-ID: References: <160508672127.25505.8356390205508789564@wrigleys.postgresql.org> <53ec9f116bea9252d7fa9341e024530553656c42.camel@cybertec.at> <16601466752e40543051369fac722c0a200bb4e6.camel@cybertec.at> <27d690d8-0987-5f2b-a2da-fc2ec7c19e3c@oss.nttdata.com> <02f3fa3a592fa6c1f8ec1a9f539ae376f744eb42.camel@cybertec.at> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Y1zrXew5vf7N2P5c" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Y1zrXew5vf7N2P5c Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you. --Y1zrXew5vf7N2P5c Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="range.diff" 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)') ... Extracts the lower bound of the range (NULL if the - range is empty or the lower bound is infinite). + range is empty or unbounded). lower(numrange(1.1,2.2)) @@ -19923,7 +19923,7 @@ SELECT NULLIF(value, '(none)') ... Extracts the upper bound of the range (NULL if the - range is empty or the upper bound is infinite). + range is empty or unbounded). upper(numrange(1.1,2.2)) @@ -19991,7 +19991,8 @@ SELECT NULLIF(value, '(none)') ... boolean - Is the range's lower bound infinite? + Is the range's lower end unbounded? A +/-Infinity lower + bound returns false. lower_inf('(,)'::daterange) @@ -20008,7 +20009,8 @@ SELECT NULLIF(value, '(none)') ... boolean - Is the range's upper bound infinite? + Is the range's upper end unbounded? A +/-Infinity upper + bound returns false. upper_inf('(,)'::daterange) @@ -20063,7 +20065,7 @@ SELECT NULLIF(value, '(none)') ... Extracts the lower bound of the multirange (NULL if the - multirange is empty or the lower bound is infinite). + multirange is empty or unbounded). lower('{[1.1,2.2)}'::nummultirange) @@ -20081,7 +20083,7 @@ SELECT NULLIF(value, '(none)') ... Extracts the upper bound of the multirange (NULL if the - multirange is empty or the upper bound is infinite). + multirange is empty or unbounded). upper('{[1.1,2.2)}'::nummultirange) @@ -20149,7 +20151,8 @@ SELECT NULLIF(value, '(none)') ... boolean - Is the multirange's lower bound infinite? + Is the multirange's lower end unbounded? A +/-Infinity lower + bound returns false. lower_inf('{(,)}'::datemultirange) @@ -20166,7 +20169,8 @@ SELECT NULLIF(value, '(none)') ... boolean - Is the multirange's upper bound infinite? + Is the multirange's upper end unbounded? A +/-Infinity upper + bound returns false. upper_inf('{(,)}'::datemultirange) --Y1zrXew5vf7N2P5c--