Re: challenging constraint situation - how do I make it

From: Alban Hertroys <alban(at)magproductions(dot)nl>
To: Harald Armin Massa <haraldarminmassa(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: challenging constraint situation - how do I make it
Date: 2006-05-24 08:52:20
Message-ID: 44741EC4.9010506@magproductions.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Harald Armin Massa wrote:
> I have a business rule which gives me rahter big challenges to "melt in
> SQL":

> But it is not really fitting; and manual editing of the table can
> disturb it. So, ist there some constraint creatable to make sure that
> "in each point of time" each id only exists once?

You probably need to write a constraint trigger, using OVERLAPS and
EXISTS operators. Writing one is rather trivial, but depends on your
exact business rules.

From your example it is not clear to me if you can have, for example,
two records with different id's within the same or overlapping timespans.

When encountering this problem I usually wonder why there isn't a data
type that can store a timestamp and can be used to create a UNIQUE INDEX
over it's values. That'd be wonderful.
Well, maybe one day I'll actually have time to create one...

--
Alban Hertroys
alban(at)magproductions(dot)nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede

// Integrate Your World //

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2006-05-24 09:09:38 Re: [SQL] (Ab)Using schemas and inheritance
Previous Message sibel karaasma 2006-05-24 08:41:05 compiling source code!!!!!!!!!!!!!!!!!!!!!!!!!!!!!