Re: Why are triggers semi-deferred?

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why are triggers semi-deferred?
Date: 2003-05-05 15:31:58
Message-ID: 5.1.0.14.0.20030506012322.0552fe80@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 08:20 AM 5/05/2003 -0700, Stephan Szabo wrote:
>Actually, I think from sql99's description, for after row triggers it
>should happen after the row is modified not after the statement as a
>whole (so given two 2 row updates in a function you'd get
> update1,row1 afterrow1-1 update1,row2 afterrow1-2,afterstatement1
> update2,row1 afterrow2-1 update2,row2 afterrow2-2,afterstatement2
>)

Totally agree (I think) -- I am not sure how to interpret your example. To
(I hope) clarify: if a function has two update statements (A & B), each of
which update two rows (1 & 2), I would expect the triggers to fire as:

Procedure Starts
Statement A executes:
Before Row 1
After Row 1
Before Row 2
After Row 2
Statement Trigger for A
Statement B executes:
Before Row 1
After Row 1
Before Row 2
After Row 2
Statement Trigger for B
Procedure Ends

At the current time in 7.3, we have:

Procedure Starts
Statement A executes:
Before Row 1
Before Row 2
Statement B executes:
Before Row 1
Before Row 2
Procedure End
After Row 1
After Row 2
After Row 1
After Row 2

...which seems weird to me. Is this something that needs fixing in 7.3.3?

----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 03 5330 3172 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Warner 2003-05-05 15:35:56 Re: Why are triggers semi-deferred?
Previous Message Tom Lane 2003-05-05 15:22:28 Re: pg_dump future problem.