Re: Determin if cascade is being used

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martin Foster <martin(at)ethereal-realms(dot)org>
Cc: PostgreSQL Novice List <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Determin if cascade is being used
Date: 2005-10-17 17:27:57
Message-ID: 9938.1129570077@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Martin Foster <martin(at)ethereal-realms(dot)org> writes:
> Is there a way to tell in PL/PgSQL if the delete coming down the line is
> from a cascade delete? I have a trigger, which when called will throw
> an error because the row its trying to change is now linked with an item
> which no longer exists. The foreign key constraint fails since it was
> removed before underlaying components were.

This sounds like you're trying to do manual enforcement of a foreign key
relationship. Wouldn't it be better to let the standard FK mechanism
handle it for you?

(But the short answer is no, I don't think you can tell that from
plpgsql, or even very reasonably from a C trigger.)

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Martin Foster 2005-10-17 19:21:25 Re: Determin if cascade is being used
Previous Message Martin Foster 2005-10-17 16:26:56 Determin if cascade is being used