Re: Foreign keys

From: weigelt(at)metux(dot)de
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Foreign keys
Date: 2003-06-28 22:02:14
Message-ID: 20030628220213.GB9442@metux.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)metux(dot)de
cellphone: +49 174 7066481 smsgate: sms(dot)weigelt(at)metux(dot)de
---------------------------------------------------------------------
Diese Mail wurde mit UUCP versandt. http://www.metux.de/uucp/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Markus Bertheau 2003-06-28 23:07:55 Re: Redhat's "enhancements" to PG
Previous Message weigelt 2003-06-28 21:52:14 Re: How many fields in a table are too many