Re: deleting referenced data

From: Jonathan Bartlett <johnnyb(at)eskimo(dot)com>
To: Andreas Fromm <Andreas(dot)Fromm(at)physik(dot)uni-erlangen(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: deleting referenced data
Date: 2003-08-27 16:18:17
Message-ID: Pine.GSU.4.44.0308270916560.1508-100000@eskimo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

PLEASE DONT USE THIS ADVICE WITHOUT TESTING IT:

You might be able to do it by a) setting up foreign key constraints,
setting the record to "on delete restrict", and then simply setting up a
trigger that attempts to delete it after every record delete. This may
screw up your transaction though, or not work at all.

Jon

On Wed, 27 Aug 2003, Andreas Fromm wrote:

> Bruno Wolff III wrote:
>
> >On Tue, Aug 26, 2003 at 18:34:04 +0100,
> > Richard Huxton <dev(at)archonet(dot)com> wrote:
> >
> >
> >I don't think that is what he wants. He seems to want to go in the other
> >direction. That is going to require custom triggers and probably adding a
> >reference count column to data-tables.
> >
> >
> This is what I want to do, but my question is how can I easely now if
> there is someone referencing a certain record. Is it just possible by
> searching every table that could reference it or is there an other way
> of doing it without adding an reference count column?
>
> Regards
>
> Andreas
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vivek Khera 2003-08-27 16:21:53 Re: Linux ready for high-volume databases?
Previous Message Jonathan Bartlett 2003-08-27 16:13:31 Re: PostgreSQL and HA?