Re: Order of trigger execution: AFTER DELETE ON EACH ROW doesn't appear to be working properly

From: aklaver(at)comcast(dot)net (Adrian Klaver)
To: "Christopher Maier" <maier(at)med(dot)unc(dot)edu>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Order of trigger execution: AFTER DELETE ON EACH ROW doesn't appear to be working properly
Date: 2008-10-13 19:08:10
Message-ID: 101320081908.26623.48F39C9A000855F3000067FF22007613949D0A900E04050E@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

-------------- Original message ----------------------
From: "Christopher Maier" <maier(at)med(dot)unc(dot)edu>
<Snip>

>
> As you can see, doing a row-by-row delete works fine, but when doing a
> bulk delete, all the before triggers are grouped together, as are all
> the after triggers.
>
> Why are these calls not interleaved (e.g. BEFORE DELETE for record 1,
> AFTER DELETE for record 1, BEFORE DELETE for record 2, AFTER DELETE
> for record 2, etc.). Is there any way I can get them to be
> interleaved? This causes problems for my application because if
> dependent rows are not deleted immediately after the row that supports
> it, then I can get "orphaned" rows left in the table that have no
> supporting rows.
>
> Thanks,
> Chris
>

Is not possible to delete the dependent rows from within the BEFORE trigger?

--
Adrian Klaver
aklaver(at)comcast(dot)net

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Preston 2008-10-13 19:23:14 Updating Query of 1 table from data in another
Previous Message Tom Lane 2008-10-13 18:30:11 Re: Order of trigger execution: AFTER DELETE ON EACH ROW doesn't appear to be working properly