Re: [NOVICE] protected ON DELETE CASCADE - Mailing list pgsql-sql

From Albert Reiner
Subject Re: [NOVICE] protected ON DELETE CASCADE
Date
Msg-id Pine.HPX.4.10.10108231409210.15991-100000@stud3.tuwien.ac.at
Whole thread Raw
In response to protected ON DELETE CASCADE  (Murray Hobbs <murray@efone.com>)
List 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.



pgsql-sql by date:

Previous
From: "Marcia Cunha"
Date:
Subject: Sql
Next
From: "Vladimir Terziev"
Date:
Subject: Problem with sequences