pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: davide <site.webmaster@email.it>
To: pgsql-sql@postgresql.org
Subject: Re: multiple PK with a non UNIQUE field
Date: Sun, 26 Jun 2005 22:20:30 +0200
Message-ID: <42BF0E0E.9030906@email.it> (raw)

> 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.



view thread (4+ messages)

Message-ID: <42BF0E0E.9030906@email.it>
Permalink:  ../42BF0E0E.9030906@email.it/
Also on:    postgresql.org/message-id/42BF0E0E.9030906@email.it

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: site.webmaster@email.it
  Subject: Re: multiple PK with a non UNIQUE field
  In-Reply-To: <42BF0E0E.9030906@email.it>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox