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

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Constraint to ensure value does NOT exist in another table?
Дата
Msg-id 7A6AE531-2041-4323-A253-1B006ACEB0A1@solfertje.student.utwente.nl
обсуждение исходный текст
Ответ на 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 16 Jun 2011, at 7:04, Mike Christensen 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?
> Thanks!


Perhaps it's possible to use a unique constraint in a third table to guarantee those foreign keys can never have the
samevalue. That would probably be more efficient than executing stored procedure code. 

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.


!DSPAM:737,4dfa49a012091645294739!



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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: Postgres performance and the Linux scheduler
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: Postgres 8.3.10 Alter Table Waiting issue