so, does this overlap or not...? - fencepost question on overlaps()

From: Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: so, does this overlap or not...? - fencepost question on overlaps()
Date: 2010-06-03 12:00:40
Message-ID: 201006031400.40835.ftm.van.vugt@foxi.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

This doesn't seem to make sense to me, can someone explain the rationale
behind it?

postgres=# select version();
version
---------------------------------------------------------------------------------------
PostgreSQL 8.4.4 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC)
4.3.3, 64-bit
(1 row)

Range 1 ending on date A does not overlap with range 2 starting on date A:

postgres=# select ('2010-01-01'::date, '2010-01-05'::date) overlaps
('2010-01-05'::date, '2010-01-10'::date);
overlaps
----------
f
(1 row)

But it does when range 1 is only a single day:

postgres=# select ('2010-01-05'::date, '2010-01-05'::date) overlaps
('2010-01-05'::date, '2010-01-10'::date);
overlaps
----------
t
(1 row)

BTW, it doesn't matter whether one casts to date or timestamp

--
Best,

Frank.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2010-06-03 12:00:50 Re: Attempting to get kerberos authentication working
Previous Message Alban Hertroys 2010-06-03 11:18:27 Re: How to debug efficiently