Re: multiple PK with a non UNIQUE field

Поиск
Список
Период
Сортировка
От davide
Тема Re: multiple PK with a non UNIQUE field
Дата
Msg-id 42BF0E0E.9030906@email.it
обсуждение исходный текст
Ответ на multiple PK with a non UNIQUE field  (davide <site.webmaster@email.it>)
Список pgsql-sql
> if you need a multi column fk don't use the "references" keyword on your create table, instead use the "FOREIGN KEY"

> keyword for the table, see the "create table" help.  
> 
> so for example (untested) change 
> 
>  CREATE TABLE appalto (
>      cod_op         int     not null references Opere,
>      cod_com     int     not null references Opere,
>      scadenza     date     not null,
>      importo        int     not null,   
>      PRIMARY KEY (cod_op,cod_com)
>  );
> 
> to
>  CREATE TABLE appalto (
>      cod_op         int     not null,
>      cod_com     int     not null,
>      scadenza     date     not null,
>      importo        int     not null,   
>      PRIMARY KEY (cod_op,cod_com),
>      FOREIGN KEY (cod_op,cod_com) REFERENCES Opere(cod_op,cod_com)
>  );
> 



In this way it works, thanks.


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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: assorted problems with intarray and other GiST contribs.
Следующее
От: Markus Bertheau ☭
Дата:
Сообщение: SELECT * FROM foo OFFSET -1 LIMIT 1