Re: complex referential integrity constraints

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: complex referential integrity constraints
Дата
Msg-id 45DEAD7A.6030307@magproductions.nl
обсуждение исходный текст
Ответ на Re: complex referential integrity constraints  ("Robert Haas" <Robert.Haas@dyntek.com>)
Ответы Re: complex referential integrity constraints  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: complex referential integrity constraints  ("Robert Haas" <Robert.Haas@dyntek.com>)
Список pgsql-general
Robert Haas wrote:
> The idea here is that a wolf can attack a sheep, or a wolf can attack
> another wolf, but sheep can't attack anything.  I suppose I could list
> each wolf in both the predator and prey tables, but that seems a bit
> duplicative (and causes other problems).
>
> ...Robert

I'm quite certain a wolf is much more likely to attack a sheep than to
attack another wolf, and even more unlikely to attack for example a
lion. It seems to me that just the fact that it can isn't enough
information.

It looks like you need "weighted constraints"; there's 0 chance that a
sheep attacks a wolf, but there's >0 chance that a wolf attacks a sheep,
>0 chance it attacks a wolf and >0 chance it attacks a lion. The exact
numbers will vary, and I have absolutely no idea what they would be
like. It probably requires some kind of ranking system that adjusts
according to the known animals and their likelihood to attack eachother.

I'm pretty sure you can't get this done without defining some triggers.

--
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 по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: complex referential integrity constraints
Следующее
От: "Anton Melser"
Дата:
Сообщение: greedy or not? regexps...