From: | Ron <ronljohnsonjr(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: "two time periods with only an endpoint in common do not overlap" ??? |
Date: | 2021-10-15 18:16:32 |
Message-ID: | d496d507-8abd-7e11-8e82-0f2983641803@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Rob Sargent | 2021-10-15 18:22:16 | Re: "two time periods with only an endpoint in common do not overlap" ??? |
Previous Message | Seref Arikan | 2021-10-15 17:50:49 | Stuck: how can I disable automatic json array unwrapping? |