Re: Foreign keys

Поиск
Список
Период
Сортировка
От weigelt@metux.de
Тема Re: Foreign keys
Дата
Msg-id 20030628220213.GB9442@metux.de
обсуждение исходный текст
Ответ на Re: Foreign keys  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
On Thu, Jun 26, 2003 at 02:12:22PM +0100, Richard Huxton wrote:

<snip>

> 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.

I'd run an garbage collection over the db from time to time.
It should be an easy test to select (or delete) all address rows which
ID doesnt exist anywhere else.

You can easily put this in an function.

cu

--
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux ITS
 Webhosting ab 5 EUR/Monat.          UUCP, rawIP und vieles mehr.

 phone:     +49 36207 519931         www:       http://www.metux.de/
 fax:       +49 36207 519932         email:     contact@metux.de
 cellphone: +49 174 7066481         smsgate:   sms.weigelt@metux.de
---------------------------------------------------------------------
 Diese Mail wurde mit UUCP versandt.      http://www.metux.de/uucp/

В списке pgsql-general по дате отправления:

Предыдущее
От: weigelt@metux.de
Дата:
Сообщение: Re: How many fields in a table are too many
Следующее
От: Markus Bertheau
Дата:
Сообщение: Re: Redhat's "enhancements" to PG