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

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: Constraint to ensure value does NOT exist in another table?
Дата
Msg-id BANLkTinZK4YoLJBfWbzipY7cgynyiVdKdA@mail.gmail.com
обсуждение исходный текст
Ответ на Constraint to ensure value does NOT exist in another table?  (Mike Christensen <mike@kitchenpc.com>)
Ответы Re: Constraint to ensure value does NOT exist in another table?  (Mike Christensen <mike@kitchenpc.com>)
Список pgsql-general
On Thu, Jun 16, 2011 at 6:04 AM, Mike Christensen <mike@kitchenpc.com> wrote:

> 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.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

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

Предыдущее
От: Mike Christensen
Дата:
Сообщение: Re: You could be a PostgreSQL Patch Reviewer!
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: Symbols and versioning of binary releases; running a symbol server