How to reject overlapping timespans?

From: Andreas <maps(dot)on(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: How to reject overlapping timespans?
Date: 2013-02-17 17:02:27
Message-ID: 51210D23.9070403@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I need to store data that has a valid timespan with start and enddate.

objects ( id, name, ... )
object_data ( object_id referencs objects(id), startdate, enddate, ... )

nothing special, yet

How can I have PG reject a data record where the new start- or enddate
lies between the start- or enddate of another record regarding the same
object_id?

Also it isn't allowed that such timespans lie within another.

There can be times where no valid data exists but there can't be more
than one valid data-record for the same point in time.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Kretschmer 2013-02-17 18:20:50 Re: How to reject overlapping timespans?
Previous Message Ben Morrow 2013-02-17 10:50:59 Re: Perform Function When The Rows Of A View Change