Re: conditional constraints

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: conditional constraints
Дата
Msg-id 3E96BFE3.F3BAF0A1@Yahoo.com
обсуждение исходный текст
Ответ на conditional constraints  (tom dyson <tom@torchbox.com>)
Ответы Re: conditional constraints  (Dennis Gearon <gearond@cvc.net>)
Список pgsql-general
tom dyson wrote:
>
> (on behalf of my colleague, Neal Todd)
>
> This question is about whether it's possible to have conditionality on a
> constraint, or rather (presuming it's not possible), how it can be emulated
> perhaps with a trigger.
>
> The scenario is this (but is fairly general anyway)...
>
> Table "P" storing projects with a project id primary key.
> and
> Table "D" storing diary entries relating to projects with foreign key
> constraint referencing project ids in table "P".
>
> Fine so far, we have referential integrity on the project ids in table "D".
>
> However, we need to add diary entries that are for a generic "non-project"
> category. Without the constraint we could just have a null or dummy (e.g. 0)
> entry in D's project id foreign key. But with the constraint the referential
> integrity is broken.

Your assumption is wrong. That's the strange thing about NULL values, we
can't tell what they are made of or where they are coming from, but we
certainly know what they are good for :-)


Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #


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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: conditional constraints
Следующее
От: "Thomas Mammen"
Дата:
Сообщение: help Request