Re: challenging constraint situation - how do I make it

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: challenging constraint situation - how do I make it
Дата
Msg-id 44741EC4.9010506@magproductions.nl
обсуждение исходный текст
Ответ на challenging constraint situation - how do I make it real in SQL?  ("Harald Armin Massa" <haraldarminmassa@gmail.com>)
Ответы Re: challenging constraint situation - how do I make it  (Kenneth Downs <ken@secdat.com>)
Список 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@magproductions.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 //

В списке pgsql-general по дате отправления:

Предыдущее
От: sibel karaasma
Дата:
Сообщение: compiling source code!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: [SQL] (Ab)Using schemas and inheritance