pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Omkar Rath <orath@cisco.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Sequence of SQL command execution involving triggers and stored procedures.
Date: Sat, 18 Sep 2004 12:39:21 -0400
Message-ID: <4960.1095525561@sss.pgh.pa.us> (raw)
In-Reply-To: <F67EB38120F7BB4BB972C7860958020704E5747F@ipcbu-exchange.amer.unity.cisco.com>
References: <F67EB38120F7BB4BB972C7860958020704E5747F@ipcbu-exchange.amer.unity.cisco.com>

"Omkar Rath" <orath@cisco.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



view thread (2+ messages)

Message-ID: <4960.1095525561@sss.pgh.pa.us>
Permalink:  ../4960.1095525561@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4960.1095525561@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, orath@cisco.com
  Subject: Re: Sequence of SQL command execution involving triggers and stored procedures.
  In-Reply-To: <4960.1095525561@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox