Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iSLRG-0008N2-Cy for pgsql-docs@arkaria.postgresql.org; Wed, 06 Nov 2019 13:33:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iSLRF-00048i-6L for pgsql-docs@arkaria.postgresql.org; Wed, 06 Nov 2019 13:33:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iSLRE-00048Y-Rs for pgsql-docs@lists.postgresql.org; Wed, 06 Nov 2019 13:33:33 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iSLRC-0007ro-9K for pgsql-docs@lists.postgresql.org; Wed, 06 Nov 2019 13:33:31 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1iSLRA-0005Fw-Nj; Wed, 06 Nov 2019 08:33:28 -0500 Date: Wed, 6 Nov 2019 08:33:28 -0500 From: Bruce Momjian To: Eugen Konkov Cc: Tom Lane , pgsql-docs@lists.postgresql.org Subject: Re: Why 'infinity' is not in range '[2019-01-02, infinity]'? Message-ID: <20191106133328.GA1843@momjian.us> References: <155655432452.1371.6115195379691603427@wrigleys.postgresql.org> <5f6b986b-de4d-8a43-1366-fc8c3aed6319@postgresql.org> <1265663903.20190429212216@yandex.ru> <7991.1556573455@sss.pgh.pa.us> <376945611.20191026161529@yandex.ru> <20191106042111.GC16353@momjian.us> <1254054284.20191106121517@yandex.ru> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="wRRV7LY7NUeQGEoC" Content-Disposition: inline In-Reply-To: <1254054284.20191106121517@yandex.ru> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Nov 6, 2019 at 12:15:17PM +0200, Eugen Konkov wrote: > ! Specifying a missing bound as exclusive is automatically converted > ! to inclusive, e.g., [,] is automatically converted > ! to (,) > > Misspell? > > You say: > exclusive is automatically converted to inclusive > But then: > [,] is automatically converted to (,) > > which one is correct? My mistake. Thanks for finding that. Updated patch attached, plus I improved the second paragraph. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription + --wRRV7LY7NUeQGEoC Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="range.diff" diff --git a/doc/src/sgml/rangetypes.sgml b/doc/src/sgml/rangetypes.sgml new file mode 100644 index 3a034d9..b75fb3a *** a/doc/src/sgml/rangetypes.sgml --- b/doc/src/sgml/rangetypes.sgml *************** SELECT isempty(numrange(1, 5)); *** 131,159 **** Infinite (Unbounded) Ranges ! The lower bound of a range can be omitted, meaning that all points less ! than the upper bound are included in the range. Likewise, if the upper ! bound of the range is omitted, then all points greater than the lower bound ! are included in the range. If both lower and upper bounds are omitted, all ! values of the element type are considered to be in the range. ! ! ! ! This is equivalent to considering that the lower bound is minus ! infinity, or the upper bound is plus infinity, ! respectively. But note that these infinite values are never values of ! the range's element type, and can never be part of the range. (So there ! is no such thing as an inclusive infinite bound — if you try to ! write one, it will automatically be converted to an exclusive bound.) ! Also, some element types have a notion of infinity, but that ! is just another value so far as the range type mechanisms are concerned. ! For example, in timestamp ranges, [today,] means the same ! thing as [today,). But [today,infinity] means ! something different from [today,infinity) — the latter ! excludes the special timestamp value infinity. --- 131,156 ---- Infinite (Unbounded) Ranges ! The lower bound of a range can be omitted, meaning that all ! values less than the upper bound are included in the range, e.g., ! (,3]. Likewise, if the upper bound of the range ! is omitted, then all values greater than the lower bound are included ! in the range. If both lower and upper bounds are omitted, all values ! of the element type are considered to be in the range. Specifying a ! missing bound as inclusive is automatically converted to exclusive, ! e.g., [,] is converted to (,). ! You can think of these missing values as +/-infinity, but they are ! special range type values and are considered to be beyond any range ! element type's +/-infinity values. ! Element types that have the notion of infinity can ! use them as explicit bound values. For example, with timestamp ! ranges, [today,infinity) excludes the special ! timestamp value infinity, ! while [today,infinity] include it, as does ! [today,) and [today,]. --wRRV7LY7NUeQGEoC--