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 1qyJJh-007XSi-R6 for pgsql-docs@arkaria.postgresql.org; Wed, 01 Nov 2023 22:04:01 +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 1qyJJg-009Emm-20 for pgsql-docs@arkaria.postgresql.org; Wed, 01 Nov 2023 22:04:00 +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 1qyJJf-009Eme-QU for pgsql-docs@lists.postgresql.org; Wed, 01 Nov 2023 22:03:59 +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 1qyJJY-004E1O-RS for pgsql-docs@lists.postgresql.org; Wed, 01 Nov 2023 22:03:59 +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=lwAo2ufA9BMDrrpZfTXVMCYwY7jzXLrwz0bkEBK6ZDM=; b=lWjI3 wPt4dePQLielsbOctyk+sg2Im8MDgKCwDRaY4FbihUcPRoP55Aovc19XEwlBsq9RcpVfYWWNHWMop pl38wjE6J2tb0O7EhmnBuFHZql0KErrWTSTxQXsbvQ0oOSIdL1865xdh7GQuUSBYl2TaS49jPvAAT qQVqoOMyUA1NWSKzujq7ZDS8B1V9hvJbXQxvxKdhtdKXg9MbpUpwn4BWTyxyWHSNelFY8SibRbSZl 4J4KUA8RuXPkyPf/2kfcrdwVkXCyhyC9pypAqOQQzKYwu36O76pMV678+sVPtNGr23clLHoHErqpo hCsFUZM83Vb387rzgk6e8FnFq5N9Q==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1qyJJT-009sS1-0m; Wed, 01 Nov 2023 18:03:47 -0400 Date: Wed, 1 Nov 2023 18:03:47 -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="Q9b1z+4l7YDmP0e0" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Q9b1z+4l7YDmP0e0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you. --Q9b1z+4l7YDmP0e0 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..aa82f8dd81 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 bound 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 bound 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 bound 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 bound unbounded? A +/-Infinity upper + bound returns false. upper_inf('{(,)}'::datemultirange) --Q9b1z+4l7YDmP0e0--