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 1mbZem-0004ci-Ty for pgsql-general@arkaria.postgresql.org; Sat, 16 Oct 2021 02:42:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mbZel-0000tg-IV for pgsql-general@arkaria.postgresql.org; Sat, 16 Oct 2021 02:42:43 +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 1mbZel-0000t9-1z for pgsql-general@lists.postgresql.org; Sat, 16 Oct 2021 02:42:43 +0000 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mbZeh-00040a-RW for pgsql-general@lists.postgresql.org; Sat, 16 Oct 2021 02:42:42 +0000 Received: by mail-ot1-x32e.google.com with SMTP id s18-20020a0568301e1200b0054e77a16651so351876otr.7 for ; Fri, 15 Oct 2021 19:42:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=E7qL10qhrMxJbAzwWF1ECVVDJjbwe/LkneKBqT7dyoY=; b=DeYoSd+FS1PQbG4+y6YYzrvKPh04FdBm0N+7VndN54sz/Xw2YzGaL7iCKkPx19EtIC O8+IHsKr2VDTC6oC4PuZSvD8XcbrAbPe8DM6Ov9+VYC8e55Xq8eWLpnHo1RZrLqm+CEr iSTjbAZUH45aD+OA5OrPyHLUUNwi0RQNnHgdnif8lqMd880OrUe57J6VYSoLn2gJcSAu QThF0vcJgfCOUNmQdwOs5GiHOQ2swJ3+H8QHuOZn8EgwFOFjTcirz+4ZYoLW2/SWc9SL HPLWkf1/t5mo1jog/oF+hxJNFtmccT1EE+bHusxa8OQ5Hs1PAGP1qz6elY2GVi4ExvhZ 7p6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=E7qL10qhrMxJbAzwWF1ECVVDJjbwe/LkneKBqT7dyoY=; b=77krT1J4AE527nH79LGXAr5oS46Q788+zBnDwIig0Tqzklmq3Rwz11bEzJkKmgodF+ Mx6lL0QsORaJNuUeoGR2gykSt94EseE+tkqiIs3Xp8MSInPwRgwTPUpC3UYc4+B5rcEp XNuV1jAz7cCb/JeiYSx5yLPFk+4TbV7C4Sxp8h2xXeTn19l3AE2yZnP4G6h6+tRBVaQX ILprDiyCF+iLoll/jlp0adeHrf4N0muMEW48wHpveDAbd+vANhtioW+f3zIwp0/tzZim aFAheZDvok3C2PCy3of4HDL4nliZa35QBoimoBeMq5X+QSLhhWKkEdGo7vz9tmpfMc+U uHmw== X-Gm-Message-State: AOAM5320uj0qVUz9LDmW0jkryKQiJ2Kj76cFkUBvW+PZSUWSL/L38KdC n+iw3+vgrWMOKYJV3ajbuBKyRvviTWQ= X-Google-Smtp-Source: ABdhPJxlofkY364vMIf1F/xXbJMVWjyde7uXwfFEQirx/lnD4ILFEzSMxzlMeCyPfvdO9LxV83x5YQ== X-Received: by 2002:a9d:6483:: with SMTP id g3mr11241765otl.105.1634352158460; Fri, 15 Oct 2021 19:42:38 -0700 (PDT) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id az14sm1569798oib.51.2021.10.15.19.42.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Oct 2021 19:42:37 -0700 (PDT) Subject: Re: "two time periods with only an endpoint in common do not overlap" ??? To: "pgsql-generallists.postgresql.org" 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> From: Ron Message-ID: <6f61f1d3-c110-e6dd-d742-1bb45fb6e90e@gmail.com> Date: Fri, 15 Oct 2021 21:42:36 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------765DD30DDFDB4641DF5C1572" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------765DD30DDFDB4641DF5C1572 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit The numeric ranges 0-10 and 10-19 overlap, just as the time ranges 00:01:00-00:00:02:00 overlaps 00:02:00-00:03:00. *It's the programmer's responsibility* to say what s/he really means, not for "the system" to make that choice. On 10/15/21 1:27 PM, Brian Dunavant wrote: > Think of it this way.  When someone says they have a meeting from 1-2 and > another from 2-3, do those meetings overlap?  They do not, because we're > actually saying the first meeting is from 1:00 through 1:59:59.99999.  >  The Postgres date ranges are the same way.   The starting point is > inclusive, but the ending time is exclusive.   So [1:00,2:00), and > [2:00,3:00), do not overlap. > > On Fri, Oct 15, 2021 at 2:16 PM Ron > wrote: > > On 10/15/21 8:59 AM, Adrian Klaver wrote: > > On 10/15/21 06:52, Ron wrote: > >> On 10/14/21 7:02 PM, Adrian Klaver wrote: > >> [snip] > >>> or the third example in the docs: > >>> > >>> SELECT (DATE '2001-02-16', DATE '2001-12-21') OVERLAPS > >>>        (DATE '2001-10-30', DATE '2002-10-30'); > >>> Result: true > >>> SELECT (DATE '2001-02-16', INTERVAL '100 days') OVERLAPS > >>>        (DATE '2001-10-30', DATE '2002-10-30'); > >>> Result: false > >>> SELECT (DATE '2001-10-29', DATE '2001-10-30') OVERLAPS > >>>        (DATE '2001-10-30', DATE '2001-10-31'); > >>> Result: false > >> > >> Why /don't/ they overlap, given that they share a common date? > > > > Per the docs: > > > > https://www.postgresql.org/docs/current/functions-datetime.html > > > > > " Each time period is considered to represent the half-open interval > start > > <= time < end, unless start and end are equal in which case it > represents > > that single time instant." > > > > Which I read as > > > > (DATE '2001-10-29', DATE '2001-10-30') ends at '2001-10-29' > > > > and > > > > (DATE '2001-10-30', DATE '2001-10-31') starts at DATE '2001-10-30' > > > > so no overlap. > > I was afraid you were going to say that.  It's completely bizarre, but > seems > to be a "thing" in computer science. > > -- > Angular momentum makes the world go 'round. > > -- Angular momentum makes the world go 'round. --------------765DD30DDFDB4641DF5C1572 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
The numeric ranges 0-10 and 10-19 overlap, just as the time ranges 00:01:00-00:00:02:00 overlaps 00:02:00-00:03:00.

It's the programmer's responsibility to say what s/he really means, not for "the system" to make that choice.

On 10/15/21 1:27 PM, Brian Dunavant wrote:
Think of it this way.  When someone says they have a meeting from 1-2 and another from 2-3, do those meetings overlap?  They do not, because we're actually saying the first meeting is from 1:00 through 1:59:59.99999.   The Postgres date ranges are the same way.   The starting point is inclusive, but the ending time is exclusive.   So [1:00,2:00), and [2:00,3:00), do not overlap.

On Fri, Oct 15, 2021 at 2:16 PM Ron <ronljohnsonjr@gmail.com> wrote:
On 10/15/21 8:59 AM, Adrian Klaver wrote:
> On 10/15/21 06:52, Ron wrote:
>> On 10/14/21 7:02 PM, Adrian Klaver wrote:
>> [snip]
>>> or the third example in the docs:
>>>
>>> SELECT (DATE '2001-02-16', DATE '2001-12-21') OVERLAPS
>>>        (DATE '2001-10-30', DATE '2002-10-30');
>>> Result: true
>>> SELECT (DATE '2001-02-16', INTERVAL '100 days') OVERLAPS
>>>        (DATE '2001-10-30', DATE '2002-10-30');
>>> Result: false
>>> SELECT (DATE '2001-10-29', DATE '2001-10-30') OVERLAPS
>>>        (DATE '2001-10-30', DATE '2001-10-31');
>>> Result: false
>>
>> Why /don't/ they overlap, given that they share a common date?
>
> Per the docs:
>
> https://www.postgresql.org/docs/current/functions-datetime.html
>
> " Each time period is considered to represent the half-open interval start
> <= time < end, unless start and end are equal in which case it represents
> that single time instant."
>
> Which I read as
>
> (DATE '2001-10-29', DATE '2001-10-30') ends at '2001-10-29'
>
> and
>
> (DATE '2001-10-30', DATE '2001-10-31') starts at DATE '2001-10-30'
>
> so no overlap.

I was afraid you were going to say that.  It's completely bizarre, but seems
to be a "thing" in computer science.

--
Angular momentum makes the world go 'round.



--
Angular momentum makes the world go 'round.
--------------765DD30DDFDB4641DF5C1572--