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

Поиск
Список
Период
Сортировка
От Igor Neyman
Тема Re: Constraint to ensure value does NOT exist in another table?
Дата
Msg-id F4C27E77F7A33E4CA98C19A9DC6722A207AB3A4A@EXCHANGE.corp.perceptron.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?
Список pgsql-general

-----Original Message-----
From: Mike Christensen [mailto:mike@kitchenpc.com]
Sent: Thursday, June 16, 2011 1:05 AM
To: pgsql-general@postgresql.org
Subject: Constraint to ensure value does NOT exist in another table?

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?
 Thanks!

Mike


Trigger (with corresponding trigger function) will definitely do the
job.

Regards,
Igor Neyman

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

Предыдущее
От: Rick Harding
Дата:
Сообщение: Re: trouble building user defined agg function with plpython
Следующее
От: Scott Ribe
Дата:
Сообщение: Re: No implicit index created when adding primary key with ALTER TABLE