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

From Simon G
Subject Re: Foreign key to a partial key
Date
Msg-id CAH5GJU8LEoTLWtJoGiVGF0RVQF=Gr81-BwzBC6iuq4qs=kJZsw@mail.gmail.com
Whole thread Raw
In response to Re: Foreign key to a partial key  (David Johnston <polobo@yahoo.com>)
List pgsql-sql
Hello, David:

You are absolutely right.

I was wrong. Although the wbs_code is not a surrogate key, I was using it like it was.
A product may have a wbs_code, but from a wbs_name, It cannot exists alone. So wbs_name has to be included in the products table. My mistake.

Your solution is what needed to be done. A FK referencing projects (wbs_name, project_id) ensures that the wbs_name used in the product is the proper wbs_name of the project. I already tried it and it works.

Thank you very much.

Simon Graffe

pgsql-sql by date:

Previous
From: David Johnston
Date:
Subject: Re: Foreign key to a partial key
Next
From: ssylla
Date:
Subject: problem with update order (?)