Re: Referencing multiple primary keys from a single table.

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Daniel Staal <DStaal(at)usa(dot)net>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Referencing multiple primary keys from a single table.
Date: 2003-09-22 22:05:50
Message-ID: 20030922150356.K11175@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, 22 Sep 2003, Daniel Staal wrote:

>
> What is the best way to reference (use as foreign key) a table with
> multiple primary keys?
>
> Here's what I have:
> Table1:
> field1
> field2
> field3
> ...
> primary key (field1, field2, field3)

This isn't multiple primary keys, it's a single primary key with
3 columns.

> Then I have another table that needs to reference Table1 with a
> foreign key. What I really want to do is:
> Table2:
> field1 Primary key
> field2 references table1

What are you actually trying to do here? field2 is a single column
and you're referencing a 3 column key, so I'm not sure what behavior
you're looking for.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Daniel Staal 2003-09-22 22:23:24 Re: Referencing multiple primary keys from a single
Previous Message Daniel Staal 2003-09-22 21:34:11 Referencing multiple primary keys from a single table.