From: | "David Johnston" <polobo(at)yahoo(dot)com> |
---|---|
To: | "'Rich Shepard'" <rshepard(at)appl-ecosys(dot)com>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Add Foreign Keys To Table |
Date: | 2011-07-07 19:45:12 |
Message-ID: | 01c201cc3cde$62ec95a0$28c5c0e0$@yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
To do what you want to do look up "CREATE INDEX" in the documentation.
You may wish to provide the PK/FK schema for the tables in questions as it
appears - at first take - that you are doing something wrong If you have a
compound Primary Key with component fields that are also "UNIQUE".
You probably need to add "BOTH" fields to "station_information" and then say
something like.
FOREIGN KEY (field1, field2) REFERENCES table (field1, field2) ...
David J.
-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Rich Shepard
Sent: Thursday, July 07, 2011 3:31 PM
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Add Foreign Keys To Table
On Thu, 7 Jul 2011, Alan Hodgson wrote:
> It implies the composite is unique. Not sta_type.
OK. Now I understand. How, then, do I add a unique constraint to each
component of the composite key so I can add them as foreign keys to the
station_information table? Or, is there another way to add those two columns
to station_information and then add the foreign key constraints?
Thanks for clarifying,
Rich
--
Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org) To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2011-07-07 19:48:34 | Re: Insufficient privileges. |
Previous Message | Alan Hodgson | 2011-07-07 19:44:48 | Re: Add Foreign Keys To Table |