From: | Jan Wieck <janwieck(at)Yahoo(dot)com> |
---|---|
To: | Forest Wilkinson <fspam(at)home(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: unreferenced primary keys: garbage collection |
Date: | 2001-01-20 22:13:27 |
Message-ID: | 200101202213.RAA12172@jupiter.jw.home |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Forest Wilkinson wrote:
> I have a database in which five separate tables may (or may not) reference
> any given row in a table of postal addresses. I am using the primary /
> foreign key support in postgres 7 to represent these references.
>
> My problem is that, any time a reference is removed (either by deleting or
> updating a row in one of the five referencing tables), no garbage
> collection is being performed on the address table. That is, when the
> last reference to an address record goes away, the record is not removed
> from the address table. Over time, my database will fill up with
> abandoned address records.
While this behaviour makes sense in your case, it's not
subject to referential integrity constraints. You could
arrange for it with custom trigger procedures, checking all
the five tables on DELETE or UPDATE on one of them.
I'll make up a little example and post it the other day -
need to take a nap now and tomorrow will be one of these
30-hour days (from MET to EST), so don't expect anything
before Monday afternoon (EST).
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-01-21 04:52:06 | Re: abstract data types? |
Previous Message | Najm Hashmi | 2001-01-20 19:50:00 | Re: Correct Syntax for alter table ..add constraint |