Re: Release changes - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Release changes
Date
Msg-id 3F2FE474.7020701@joeconway.com
Whole thread Raw
In response to Re: Release changes  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Release changes
List pgsql-hackers
Bruce Momjian wrote:
> How are statement level triggers supposed to work?  Are they just
> triggers deferred until the end of the statement?  You mentioned access
> to the affected rows, but I don't understand how that is supposed to
> happen.

I'm not sure this is a fair assessment of statement level triggers. Yes, 
in MSSQL you can access the rows involved in the statement, but in 
Oracle you cannot (emphasis added):

"Accessing Column Values in Row Triggers
Within a trigger body of a *row trigger*, the PL/SQL code and SQL 
statements have access to the old and new column values of the current 
row affected by the triggering statement..."

See:
http://www.engin.umich.edu/caen/wls/software/oracle/appdev.901/a88876/adg13trg.htm#526

MSSQL does not have row level triggers at all (I know they didn't in 
6.5, and looking at the help file it doesn't appear that they were added 
even in MSSQL 2000), so access at the statement level is needed to do 
anything useful at all.

"deleted and inserted are logical (conceptual) tables. They are 
structurally similar to the table on which the trigger is defined, that 
is, the table on which the user action is attempted, and hold the old 
values or new values of the rows that may be changed by the user action."

Joe



pgsql-hackers by date:

Previous
From: Andreas Pflug
Date:
Subject: Re: Release changes: statement level triggers
Next
From: Andrew Dunstan
Date:
Subject: Re: logging stuff