detecting recurring appointment conflicts

From: Ben Chobot <bench(at)silentmedia(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: detecting recurring appointment conflicts
Date: 2008-09-13 15:44:46
Message-ID: B7A6ACE8-0C53-4BB4-88C9-A28DF835047B@silentmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'd like to store recurring appointments in my database, and be pretty
accepting in the scheduling of those appointments. For instance, I
want to accept both "every other Tuesday starting 2008-11-04" as well
as "every 3rd October 13th starting 2009." Storing those appointments
isn't that hard, but what isn't at all obvious to me (and what I'm
hoping is obvious to somebody else) is how to efficiently detect if
and when overlaps will occur.

I can see a few ways to look for schedule overlaps in a defined
window, but ideally, I'd like to know if there will be overlaps at any
time, not just in, say, the next 10 years. (Though, admittedly, the
next 10 years is probably sufficient.) Is this something somebody has
tackled before?

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-09-13 16:12:21 Re: Possible limit on transaction size?
Previous Message Gregory Stark 2008-09-13 14:09:27 Re: "Healing" a table after massive updates