Re: Foreign keys - Mailing list pgsql-general

From Richard Huxton
Subject Re: Foreign keys
Date
Msg-id 200306261412.22920.dev@archonet.com
Whole thread Raw
In response to Re: Foreign keys  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Foreign keys  (weigelt@metux.de)
List 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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Question regarding performance (large objects involved)
Next
From: Tom Lane
Date:
Subject: Re: INSERT WHERE NOT EXISTS