Re: Foreign key to a partial key - Mailing list pgsql-sql

From David Johnston
Subject Re: Foreign key to a partial key
Date
Msg-id 1394332674081-5795296.post@n5.nabble.com
Whole thread Raw
In response to Foreign key to a partial key  (Simon G <simonjgl@gmail.com>)
Responses Re: Foreign key to a partial key  (Simon G <simonjgl@gmail.com>)
List pgsql-sql
> I thought of creating a foreign key constraint this way:
> 
> The constraint would need to make reference to the wbs_name assigned to
> the
> project, but at the table products, no column contains that info.

Add the wbs_name column to the products table.  Since a code is invalid
without knowing which project it belongs to your table definition is wrong.

Then you can create the proper two-column foreign key that references on
primary key on the codes table.

David J.





--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Foreign-key-to-a-partial-key-tp5795291p5795296.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.



pgsql-sql by date:

Previous
From: Simon G
Date:
Subject: Foreign key to a partial key
Next
From: Simon G
Date:
Subject: Re: Foreign key to a partial key