Re: problem with uniques and foreing keys

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: problem with uniques and foreing keys
Дата
Msg-id 20060506115248.G47923@megazone.bigpanda.com
обсуждение исходный текст
Ответ на problem with uniques and foreing keys  ("kernel.alert kernel.alert" <kernel.alert@gmail.com>)
Список pgsql-sql
On Sat, 6 May 2006, kernel.alert kernel.alert wrote:

> I create the follow tables...
>
> --------------------------------------------------------
>
> CREATE TABLE empresa (
>   id_empresa         integer  NOT NULL primary key,
>   nombre             varchar(45),
> );
> CREATE TABLE casino (
>   id_casino          integer  NOT NULL,
>   id_empresa         integer      REFERENCES empresa(id_empresa),
>
>   nombre             varchar(45),
>
>   primary key(id_casino,id_empresa)
> );
> CREATE TABLE maq_casino (
>   id_empresa      integer  NOT NULL REFERENCES  casino(id_empresa),
>   id_casino       integer  NOT NULL REFERENCES  casino(id_casino),

You probably want a table level constraint like:

foreign key (id_casino, id_empresa) references casino(id_casino,
id_empresa)

That's not the same as two single-column constraints which is what you
have above.


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

Предыдущее
От: "kernel.alert kernel.alert"
Дата:
Сообщение: Re: problem with uniques and foreing keys
Следующее
От: Bryce Nesbitt
Дата:
Сообщение: Re: grant select on database demo to user