Re: multiple primary keys and reference - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: multiple primary keys and reference
Date
Msg-id 20020610085457.L67911-100000@megazone23.bigpanda.com
Whole thread Raw
In response to multiple primary keys and reference  (Matt <matthew.berardi@weilpublishing.com>)
List pgsql-sql
On Fri, 7 Jun 2002, Matt wrote:

> I have a table, OrderDetail, with two primary keys OrderID and ProductID

I assume you mean it has a primary key with two columns.
>
> I want another table, Claims, to reference the primary keys of
> OrderDetail so that the pair has to match between table not just one
> attrib. I can't figure out how to do this from the docs I have. can
> anyone help? thankyou in advance

If I understand what you want, use the table constraint form of foreign
keys:

create table a (a int, b int, primary key(a,b));
create table b (a int, b int, foreign key(a,b) references a);




pgsql-sql by date:

Previous
From: Achilleus Mantzios
Date:
Subject: Re: multiple primary keys and reference
Next
From: Stephan Szabo
Date:
Subject: Re: VIEWs and FOREIGN keys