Foreign key with check?

Поиск
Список
Период
Сортировка
От Jeff Boes
Тема Foreign key with check?
Дата
Msg-id 42E7E9B3.4080500@endpoint.com
обсуждение исходный текст
Ответы Re: Foreign key with check?  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-sql
Given a table like this:

create table primary ( a integer primary key, b boolean
);

And another like this:

create table secondary ( a integer, some_other_fields
);


I would like a foreign key constraint on the "secondary" table that
looks something like:

foreign key (a, true) references primary (a, b)

That is, a row in "secondary" is allowed to reference a row in "primary"
if and only if that referenced row has (b = true).

I think I have to do this with an additional trigger. Any other options?



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

Предыдущее
От: Chris Browne
Дата:
Сообщение: Re: REINDEX DATABASE
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Foreign key with check?