Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbcAn-0002zX-Lg for pgsql-general@arkaria.postgresql.org; Sat, 16 Oct 2021 05:23:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mbcAl-0003rW-Ql for pgsql-general@arkaria.postgresql.org; Sat, 16 Oct 2021 05:23:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbcAl-0003rN-HC for pgsql-general@lists.postgresql.org; Sat, 16 Oct 2021 05:23:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbcAj-0005DC-Ea for pgsql-general@lists.postgresql.org; Sat, 16 Oct 2021 05:23:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 19G5NpTQ1031324; Sat, 16 Oct 2021 01:23:51 -0400 From: Tom Lane To: Ron cc: "pgsql-generallists.postgresql.org" Subject: Re: "two time periods with only an endpoint in common do not overlap" ??? In-reply-to: References: <820B633E-90C6-40F0-81A0-CAA074E5762F@yugabyte.com> <2ff5f521-34ab-8690-180a-864441e4f15b@aklaver.com> <0782c52d-2a80-b37f-0b9e-1a2a7cfb68c5@gmail.com> <98ea7ea3-38ac-d145-e668-803e5ea14de7@aklaver.com> <6f61f1d3-c110-e6dd-d742-1bb45fb6e90e@gmail.com> Comments: In-reply-to Ron message dated "Fri, 15 Oct 2021 23:54:27 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1031322.1634361831.1@sss.pgh.pa.us> Date: Sat, 16 Oct 2021 01:23:51 -0400 Message-ID: <1031323.1634361831@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ron writes: > OP refers to the OVERLAP operator (is it an operator), not the tsrange() > function. Indeed. SQL92 defines OVERLAP thus: 6) The result of the is the result of the following expression: ( S1 > S2 AND NOT ( S1 >= T2 AND T1 >= T2 ) ) OR ( S2 > S1 AND NOT ( S2 >= T1 AND T2 >= T1 ) ) OR ( S1 = S2 AND ( T1 <> T2 OR T1 = T2 ) ) where S1 is the smaller of the first range's endpoints and T1 is the larger; similarly S2/T2 are the smaller/larger of the second range's. (I gloss over the question of what to do with NULL endpoints; but the apparent redundancies in the above seem to be meant to define what happens with NULLs.) I submit that our description using half-open ranges is clearer than the spec's. Nonetheless, they're equivalent. regards, tom lane