Re: Any function for calculating inersect of intervals?

From: Alban Hertroys <alban(at)magproductions(dot)nl>
To: Együd Csaba <csegyud(at)vnet(dot)hu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Any function for calculating inersect of intervals?
Date: 2005-01-17 16:48:38
Message-ID: 41EBEC66.8010909@magproductions.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Együd Csaba wrote:
> Hi,
> wondering if exists any functions which aim to calculate intersect of two
> intervals.
> E.g. I have four dates (D1, D2, D3, D4) and I want to know if (D1,D2)
> intersects (D3,D4) or not.

Try INTERSECTS :P

SELECT * FROM table WHERE (D1, D2) INTERSECTS (D3, D4);

Related, are there any operators/functions to test for adjacency (start
of one is end of other), inclusion (interval is inside other interval)
or wrapping (the inverse; interval is around other interval) of intervals?

Alban.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2005-01-17 16:54:26 Re: Any function for calculating inersect of intervals?
Previous Message Tom Lane 2005-01-17 16:37:27 Re: Any function for calculating inersect of intervals?