Skip site navigation (1) Skip section navigation (2)

Re: Sequence of SQL command execution involving triggers and stored procedures.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Omkar Rath" <orath(at)cisco(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Sequence of SQL command execution involving triggers and stored procedures.
Date: 2004-09-18 16:39:21
Message-ID: 4960.1095525561@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-sql
"Omkar Rath" <orath(at)cisco(dot)com> writes:
> Say there is a stored procedure i.e FUNCTION sp_foo(...) which has say,
> SQL commands (any of SELECT,INSERT,UPDATE,DELETE) in its body, say S1
> followed by S2 then S3.... Furthermore, execution of statement S2
> results in trigger functions getting invoked (that contain yet other SQL
> statements).
>
> By the time, the trigger functions execute (as a result of S2), S3 has
> already executed.

In existing PG releases, AFTER triggers are always fired at the
completion of the whole interactive command (ie, the outer SELECT that
called sp_foo).

There are changes in 8.0 to fire them at the end of the specific query
that triggered them, which I believe will do what you want.

			regards, tom lane

In response to

pgsql-sql by date

Next:From: Christopher BrowneDate: 2004-09-18 17:20:15
Subject: Re: How to check postgres running or not ?
Previous:From: Greg StarkDate: 2004-09-18 15:39:01
Subject: Re: 1-byte integers

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group