Re: Why are triggers semi-deferred?

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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 16:23:54
Message-ID: 5.1.0.14.0.20030506021859.04272620@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 12:07 PM 5/05/2003 -0400, Tom Lane wrote:
>Wouldn't you want to wait till end of statement so you
>know that the whole statement is in fact going to complete (and not
>die at some later row)?

So you are suggesting:

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

This seems like a nice optimization, but probably disagrees with the spec
since we would be deferring the triggerred action (slightly). From a users
point of view, I would be happy with it, and even prefer it to my
interpretation of the spec.

But in the case of multi-row updates, won't it be expensive to keep all the
context?

----------------------------------------------------------------
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 Tom Lane 2003-05-05 16:54:00 Re: Transform groups (more FE/BE protocol issues)
Previous Message Philip Warner 2003-05-05 16:14:52 Re: Why are triggers semi-deferred?