Re: Foreign key reference causes invalid DELETE trigger calls - Mailing list pgsql-general

From Tom Lane
Subject Re: Foreign key reference causes invalid DELETE trigger calls
Date
Msg-id 18262.1131563265@sss.pgh.pa.us
Whole thread Raw
In response to Foreign key reference causes invalid DELETE trigger calls  ("Andrus" <eetasoft@online.ee>)
List pgsql-general
"Andrus" <eetasoft@online.ee> writes:
> Postgres 8.1 calls "foo" delete trigger when record is deleted from master
> table "klient". Why ?

Because you have an ON DELETE CASCADE.  That leads to a DELETE ... WHERE ...
on the slave table; whether any records actually get deleted depends on
what the DELETE finds.  This is a general hazard of using STATEMENT
triggers: you have no info about whether the statement actually did
anything.  (It's rather silly to imagine that a BEFORE STATEMENT trigger
would have any way to know that anyway.  We currently don't tell an
AFTER STATEMENT trigger anything either; though that may change
someday.)

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Hanging creating of function
Next
From: "Mikael Carneholm"
Date:
Subject: Re: Hanging creating of function