Re: [NOVICE] protected ON DELETE CASCADE

From: Albert Reiner <e8901869(at)student(dot)tuwien(dot)ac(dot)at>
To: Murray Hobbs <murray(at)efone(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [NOVICE] protected ON DELETE CASCADE
Date: 2001-08-23 12:12:32
Message-ID: Pine.HPX.4.10.10108231409210.15991-100000@stud3.tuwien.ac.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice pgsql-sql

On Thu, 23 Aug 2001, Murray Hobbs wrote:

> A <- B
> A <- C <- D
>
> i want to maintain integrity so that if A is deleted from then so is
> anything referencing from B and C - no problem ON DELETE CASCADE
>
> but if there are any D's that point back to A (through composite key in
> C) i don't want the delete to go ahead - at all - i want an error
> message and condition

what about ON DELETE RESTRICT there?

> I've looked at TRIGGER but then i'm writing a function (in SQL?) which
> is called by a trigger - again - how do i confirm or reject a delete?

Look at the docs: there is a difference between DO and DO INSTEAD (I
think, I am no expert on Pg, and I do not have access to a Pg system right
now).

Albert.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gilles DAROLD 2001-08-23 12:35:47 Re: Postgresql log analyzer
Previous Message Ben-Nes Michael 2001-08-23 11:46:47 store in bytea

Browse pgsql-novice by date

  From Date Subject
Next Message Oliver Elphick 2001-08-23 12:28:47 Re: integrity and inherit
Previous Message Bo Lorentsen 2001-08-23 10:20:03 integrity and inherit

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2001-08-23 13:55:37 Re: protected ON DELETE CASCADE
Previous Message Jaydip 2001-08-23 07:50:52 Help On Postgresql