Re: Foreign keys

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: Matt Browne <mattb(at)fusion-advertising(dot)co(dot)uk>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Foreign keys
Date: 2003-06-26 12:40:49
Message-ID: Pine.LNX.4.44.0306260535180.16059-100000@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Matt Browne wrote:

> Basically, we have a fairly complex database, with many tables
> (customers, etc) that need to reference addresses that are contained in
> a generic address table.

> So:
> customer_addresses [table]
> supplier_addresses [table]
> address [table]

I've stumbled late onto this thread so I may have missed something
important. However, I need to ask: are you keeping the same address in two
different tables? That is, are customer_addresses records duplicated in
address, and the same for supplier_addresses?

If so, you've violated a normalization rule in your schema and it's no
wonder that you can't delete all the addresses you want.

How do you synchronize addresses in multiple tables and, much more
importantly, why do you have multiple records?

In every database I've designed, the address is with the name record. If a
customer, supplier or whatever had multiple addresses, then I'd put _all_
addresses in a single table and reference each one to the name record in the
appropriate table.

What have I missed here?

Rich

Dr. Richard B. Shepard, President

Applied Ecosystem Services, Inc. (TM)
2404 SW 22nd Street | Troutdale, OR 97060-1247 | U.S.A.
+ 1 503-667-4517 (voice) | + 1 503-667-8863 (fax) | rshepard&#64;appl-ecosys.com
http://www.appl-ecosys.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lincoln Yeoh 2003-06-26 13:06:09 Re: INSERT WHERE NOT EXISTS
Previous Message Matt Browne 2003-06-26 12:34:49 Re: Foreign keys