pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Matt <matthew.berardi@weilpublishing.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: multiple primary keys and reference
Date: Mon, 10 Jun 2002 08:58:00 -0700 (PDT)
Message-ID: <20020610085457.L67911-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <3D0110C1.5020908@weilpublishing.com>

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);





view thread (3+ messages)

Message-ID: <20020610085457.L67911-100000@megazone23.bigpanda.com>
Permalink:  ../20020610085457.L67911-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20020610085457.L67911-100000@megazone23.bigpanda.com

 · 

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: sszabo@megazone23.bigpanda.com, matthew.berardi@weilpublishing.com
  Subject: Re: multiple primary keys and reference
  In-Reply-To: <20020610085457.L67911-100000@megazone23.bigpanda.com>

* 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