Re: Constraint to ensure value does NOT exist in another table?

Поиск
Список
Период
Сортировка
От Mike Christensen
Тема Re: Constraint to ensure value does NOT exist in another table?
Дата
Msg-id BANLkTi=Ys4mRchmLk7nGf3=-0ww+h5J2_A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Constraint to ensure value does NOT exist in another table?  (Simon Riggs <simon@2ndQuadrant.com>)
Список pgsql-general
>> I know I can setup a FK constraint to make sure Table1.ColA exists in
>> Table2.Key, however what if I want to do the reverse?
>>
>> I want to ensure Table1.ColA does NOT exist in Table2.Key..  Can I do
>> this with any sort of CHECK constraint, trigger, custom function, etc?
>
>
> The most common constraints are provided for, but then after that you
> have to use triggers.
>
> PostgreSQL deliberately doesn't support queries in CHECK constraints
> for this reason.

Thanks!  I wrote a Trigger for this and it seems to work fairly well..
 I kinda figured that was the obvious way, but thought there might be
some new 9.x feature that made this sort of thing possible.

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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: Symbols and versioning of binary releases; running a symbol server
Следующее
От: salah jubeh
Дата:
Сообщение: order by and view def.