Re: Question of Table Design and Foreign Keys

From: David Pratt <fairwinds(at)eastlink(dot)ca>
To: Jason Minion <jason(dot)minion(at)sigler(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Question of Table Design and Foreign Keys
Date: 2005-05-31 16:33:37
Message-ID: BD59D321-D1F1-11D9-AEE7-000A27B3B070@eastlink.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Jason, many thanks Jason for your reply.

On Tuesday, May 31, 2005, at 11:25 AM, Jason Minion wrote:

> I think the way you want to look at it is: if a record exists in
> sample_attributesjoin, then it needs to reference both samples
> and attributes. You don't need to worry about samples or attributes
> being "off" because they don't have "enough" references, instead
> you want to ensure that if a record exists (whether inserted,
> updated, or references are deleted) in sample_attributesjoin
> that the sample_id and attribute_id are always valid.
>

Yes, this is what I was thinking but just needed to ensure this was the
right approach since I have a number of tables and similar
circumstances. So if there is no attributes for a sample record when I
join the tables and query, I will just have nothing returned for these
records and no trouble with integrity, am I correct? When I up update
or delete records that I have added to attributesjoin, the referential
integrity of attributes and samples table is maintained using the
constraints, have I got this right?

Regards,
David

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Marc G. Fournier 2005-05-31 17:45:56 Major flood of mail to lists ...
Previous Message Myli 2005-05-31 15:44:46 new antidote discovered