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

2021-10-17 Thread Francisco Olarte
Ron: On Fri, 15 Oct 2021 at 20:16, Ron wrote: > > 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. Right half open intervals are normally choosed because they can fully cover the real line without overlap. Full

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

2021-10-16 Thread Adrian Klaver
On 10/15/21 21:54, Ron wrote: 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.

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

2021-10-16 Thread Gavin Flower
On 16/10/21 18:41, David G. Johnston wrote: On Friday, October 15, 2021, Ron wrote: Prima facie, if you were told "numbers in the range 0-10", would you really think, "ah, they *really* mean 0 through 9"? I would indeed default to both endpoints of the range being inclusive.  I

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

2021-10-15 Thread David G. Johnston
On Friday, October 15, 2021, Ron wrote: > > Prima facie, if you were told "numbers in the range 0-10", would you > really think, "ah, they *really* mean 0 through 9"? > > I would indeed default to both endpoints of the range being inclusive. I also begin counting at one, not zero. I’ve long

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

2021-10-15 Thread Tom Lane
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 ) )

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

2021-10-15 Thread Ron
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

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

2021-10-15 Thread Ron
On 10/15/21 11:35 PM, David G. Johnston wrote: On Friday, October 15, 2021, 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

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

2021-10-15 Thread David G. Johnston
On Friday, October 15, 2021, 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. > The system

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

2021-10-15 Thread Adrian Klaver
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:

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

2021-10-15 Thread Ron
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

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

2021-10-15 Thread Adrian Klaver
On 10/15/21 12:26, Guyren Howe wrote: I’m a bit confused by this conversation. Open- and closed-ended ranges behave as I would expect. What is the part that confused you? select tsrange('2016-01-10 17:00', '2016-01-11 17:00', '[)') && tsrange('2016-01-11 17:00', '2016-01-12 17:00', '[]')

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

2021-10-15 Thread Guyren Howe
I’m a bit confused by this conversation. Open- and closed-ended ranges behave as I would expect. select tsrange('2016-01-10 17:00', '2016-01-11 17:00', '[)') && tsrange('2016-01-11 17:00', '2016-01-12 17:00', '[]') false select tsrange('2016-01-10 17:00', '2016-01-11 17:00', '[]') &&

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

2021-10-15 Thread Brian Dunavant
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.9. The Postgres date ranges are the same way. The starting point is inclusive,

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

2021-10-15 Thread Rob Sargent
I was afraid you were going to say that.  It's completely bizarre, but seems to be a "thing" in computer science. Or maybe it's a "math thing".  But an overlap implies some length. A point has no length.  Maybe think of them as abutting one another? One ends /there/, the other starts

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

2021-10-15 Thread Ron
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

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

2021-10-15 Thread Tom Lane
Ron writes: > On 10/14/21 7:02 PM, Adrian Klaver wrote: >> 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? They don't. Per the fine manual [1]: Each

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

2021-10-15 Thread Adrian Klaver
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   

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

2021-10-15 Thread Ron
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

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

2021-10-14 Thread Bryn Llewellyn
> David Johnston wrote: > >> Bryn wrote: >> >> This means for instance that two time periods with only an endpoint in >> common do not overlap. > > A range has two endpoints. The one at the later (end) of the range and the > one at the earlier (start). I suppose rewording it to say “boundary

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

2021-10-14 Thread Tom Lane
"David G. Johnston" writes: > A range has two endpoints. The one at the later (end) of the range and the > one at the earlier (start). I suppose rewording it to say "boundary point" > in common would avoid the ambiguity in the use of the word "end". Hmm, it seems clear to me in the context of

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

2021-10-14 Thread David G. Johnston
On Thu, Oct 14, 2021, 16:38 Bryn Llewellyn wrote: > . This means for instance that two time periods with only an endpoint in > common do not overlap. > > A range has two endpoints. The one at the later (end) of the range and the one at the earlier (start). I suppose rewording it to say

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

2021-10-14 Thread Adrian Klaver
On 10/14/21 16:38, Bryn Llewellyn wrote: I’m quoting this from “9.9. Date/Time Functions and Operators” in the PG Version 14 doc on the “overlaps” operator, here: www.postgresql.org/docs/14/functions-datetime.html It’s the same in

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

2021-10-14 Thread Tom Lane
Bryn Llewellyn writes: > I tried this obvious test (using Version 13.4): > with c as ( > select > '2000-01-15'::timestamp as start_1, > '2000-02-15'::timestamp as start_2, > '2000-03-15'::timestamp as common_endpoint) > select ( > (start_1, common_endpoint) overlaps > (start_2,

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

2021-10-14 Thread Bryn Llewellyn
I’m quoting this from “9.9. Date/Time Functions and Operators” in the PG Version 14 doc on the “overlaps” operator, here: www.postgresql.org/docs/14/functions-datetime.html It’s the same in “current”—and in the Version 11 doc. « This expression yields true when two time periods (defined by