Re: "two time periods with only an endpoint in common do not overlap" ???

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: "pgsql-generallists(dot)postgresql(dot)org" <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-16 04:54:27
Message-ID: bb79ff9e-acee-c73d-3379-bea13db377b9@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/15/21 11:08 PM, Adrian Klaver wrote:
> On 10/15/21 19:42, Ron wrote:
>>
>> 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.
>>
>
> It is the programmers choice:
>
> --The canonical form.
> --No overlap
> select int4range(1,3), int4range(3, 5);
>  int4range | int4range
> -----------+-----------
>  [1,3)     | [3,5)
>
>  select int4range(1,3) && int4range(3, 5);
>  ?column?
> ----------
>  f
>
> --Making it overlap
> select int4range(1,3, '[]'), int4range(3, 5, '[]');
>  int4range | int4range
> -----------+-----------
>  [1,4)     | [3,6)
>
>  select int4range(1,3, '[]') && int4range(3, 5, '[]');
>  ?column?
> ----------
>  t
>
>
> There is no straight time range, you would have to use tsrange or
> tstzrange. The principle still holds though you can make ranges overlap or
> not depending on '[)' or '[]'.

OP refers to the OVERLAP operator (is it an operator), not the tsrange()
function.

--
Angular momentum makes the world go 'round.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-10-16 05:23:51 Re: "two time periods with only an endpoint in common do not overlap" ???
Previous Message Ron 2021-10-16 04:52:48 Re: "two time periods with only an endpoint in common do not overlap" ???