pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ron <ronljohnsonjr@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: "two time periods with only an endpoint in common do not overlap" ???
Date: Sat, 16 Oct 2021 01:23:51 -0400
Message-ID: <1031323.1634361831@sss.pgh.pa.us> (raw)
In-Reply-To: <bb79ff9e-acee-c73d-3379-bea13db377b9@gmail.com>
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>
	<d496d507-8abd-7e11-8e82-0f2983641803@gmail.com>
	<CAJ2+uGWsa0kZH2zvfBADMo=qy9UJC4aMuHLgQyVHMZyGFx==QQ@mail.gmail.com>
	<6f61f1d3-c110-e6dd-d742-1bb45fb6e90e@gmail.com>
	<e4c9e650-8361-8f8e-2357-e4919e2ed8d7@aklaver.com>
	<bb79ff9e-acee-c73d-3379-bea13db377b9@gmail.com>

Ron <ronljohnsonjr@gmail.com> 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 <overlaps predicate> 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





view thread (24+ messages)  latest in thread

Message-ID: <1031323.1634361831@sss.pgh.pa.us>
Permalink:  ../1031323.1634361831@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1031323.1634361831@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ronljohnsonjr@gmail.com
  Subject: Re: "two time periods with only an endpoint in common do not overlap" ???
  In-Reply-To: <1031323.1634361831@sss.pgh.pa.us>
  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> <d496d507-8abd-7e11-8e82-0f2983641803@gmail.com> <CAJ2+uGWsa0kZH2zvfBADMo=qy9UJC4aMuHLgQyVHMZyGFx==QQ@mail.gmail.com> <6f61f1d3-c110-e6dd-d742-1bb45fb6e90e@gmail.com> <e4c9e650-8361-8f8e-2357-e4919e2ed8d7@aklaver.com> <bb79ff9e-acee-c73d-3379-bea13db377b9@gmail.com> <1031323.1634361831@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox