Re: Foreign keys

From: Richard Huxton <dev(at)archonet(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>, 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 13:12:22
Message-ID: 200306261412.22920.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday 26 Jun 2003 1:40 pm, Rich Shepard wrote:
> > 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.

It looks like he has a centralised "address" table with "customer_addresses"
linking "customer" to "address". Likewise for "supplier".

His problem was he wanted to remove address details when nothing referred to
them any more.

--
Richard Huxton

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Bartlett 2003-06-26 13:24:53 Re: How many fields in a table are too many
Previous Message Lincoln Yeoh 2003-06-26 13:06:09 Re: INSERT WHERE NOT EXISTS