agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: David Johnston <polobo@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: Re: Foreign key to a partial key
Date: Sat, 8 Mar 2014 18:37:54 -0800 (PST)
Message-ID: <1394332674081-5795296.post@n5.nabble.com> (raw)
In-Reply-To: <CAH5GJU8_+621Zj4JuC0QOx_h-+ax+pNVM6W5_UFrJJ_nWoBVXw@mail.gmail.com>
References: <CAH5GJU8_+621Zj4JuC0QOx_h-+ax+pNVM6W5_UFrJJ_nWoBVXw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (5+ messages)  latest in thread

Message-ID: <1394332674081-5795296.post@n5.nabble.com>
Permalink:  ../1394332674081-5795296.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1394332674081-5795296.post@n5.nabble.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: polobo@yahoo.com
  Subject: Re: Foreign key to a partial key
  In-Reply-To: <1394332674081-5795296.post@n5.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox