check constraint on multiple tables?

Поиск
Список
Период
Сортировка
От Louis-David Mitterrand
Тема check constraint on multiple tables?
Дата
Msg-id 20100303150227.GA18661@apartia.fr
обсуждение исходный текст
Ответы Re: check constraint on multiple tables?  (Richard Broersma <richard.broersma@gmail.com>)
Re: check constraint on multiple tables?  ("Little, Douglas" <DOUGLAS.LITTLE@orbitz.com>)
Список pgsql-sql
Hi,

I've got this chain of tables:

ship --> (id_ship) --> cabin_type --> (id_cabin_type) --> cabin_category--> (id_cabin_category) --> cabin

The 'cabin' table has (cabin_number, id_cabin_category ref. cabin_category)

How can I guarantee unicity of cabin_number per ship?

For now I added a unique(cabin_number,id_cabin_category) but this does
not guarantee unicity for (cabin_number,ship.id_ship).

What is the best solution? Adding an id_ship to 'cabin'? Or check'ing
with a join down to 'ship'? (if possible).

Thanks,


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

Предыдущее
От: John
Дата:
Сообщение: determine the curval() of a view
Следующее
От: Richard Broersma
Дата:
Сообщение: Re: check constraint on multiple tables?