Re: Foreign keys

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Foreign keys
Дата
Msg-id 200306261412.22920.dev@archonet.com
обсуждение исходный текст
Ответ на Re: Foreign keys  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Foreign keys  (weigelt@metux.de)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Question regarding performance (large objects involved)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: INSERT WHERE NOT EXISTS