Re: Foreign key reference causes invalid DELETE trigger calls

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Andrus" <eetasoft(at)online(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Foreign key reference causes invalid DELETE trigger calls
Date: 2005-11-09 19:07:45
Message-ID: 18262.1131563265@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Andrus" <eetasoft(at)online(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mikael Carneholm 2005-11-09 19:19:32 Re: Hanging creating of function
Previous Message Gavin M. Roy 2005-11-09 19:07:39 Kudos to the pgAdmin3 Team