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 1h1z58-0006nA-3y for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Mar 2019 19:53:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h1z55-0003nm-OW for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Mar 2019 19:53:27 +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 1h1z54-0003nR-NU for pgsql-bugs@lists.postgresql.org; Thu, 07 Mar 2019 19:53:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1z51-00043l-42 for pgsql-bugs@lists.postgresql.org; Thu, 07 Mar 2019 19:53:24 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x27JrJvH027558; Thu, 7 Mar 2019 14:53:19 -0500 From: Tom Lane To: david@landgren.net cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15675: upper_inf() always returns false for non-null daterange, tstzrange values In-reply-to: <15675-6a1d056ced2aba10@postgresql.org> References: <15675-6a1d056ced2aba10@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 07 Mar 2019 14:16:19 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <27556.1551988399.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 07 Mar 2019 14:53:19 -0500 Message-ID: <27557.1551988399@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > I have encountered some counter-intuitive behaviour in upper_inf() > select > upper_inf('["2019-01-01",]'::daterange) as upper_null, > upper_inf('["2019-01-01","2019-01-02"]'::daterange) as upper_valid, > upper_inf('["2019-01-01",infinity]'::daterange) as upper_infinity; > upper_null =E2=94=82 upper_valid =E2=94=82 upper_infinity > =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80 > t =E2=94=82 f =E2=94=82 f > I would have expected ["2019-01-01",infinity] (upper_infinity above) to > return true as well. No; this is the intended and documented behavior, per the same documentation section you quote, https://www.postgresql.org/docs/current/rangetypes.html#RANGETYPES-INFINIT= E As shown in the examples there, a datatype value that happens to be named "infinity" is just another value so far as the range mechanisms are concerned, and there's a good reason for it: including or excluding that value leads to valid but different ranges. In hindsight, it was probably unwise to use "inf"/"infinite" as the terminology for ranges; "unbounded" might've been less likely to provoke confusion with datatypes that have values named "infinity". But we're stuck with that naming now. regards, tom lane