Re: After Insert or Update Trigger Issues! - Mailing list pgsql-general

From Michael Fuhr
Subject Re: After Insert or Update Trigger Issues!
Date
Msg-id 20050328020658.GA60315@winnie.fuhr.org
Whole thread Raw
In response to After Insert or Update Trigger Issues!  (Kyrill Alyoshin <kyrill@technolog.ca>)
List pgsql-general
On Sun, Mar 27, 2005 at 07:28:21PM -0500, Kyrill Alyoshin wrote:
>
> I cannot get AFTER INSERT (or UPDATE for that matter) triggers to work.
> The same code works perfectly fine for BEFORE triggers.

You're trying to modify the record but it's too late in an AFTER
trigger.  See the "Triggers" chapter in the documentation:

  The return value is ignored for row-level triggers fired after
  an operation, and so they may as well return NULL.

The PL/pgSQL "Trigger Procedures" section repeats the above:

  The return value of a BEFORE or AFTER statement-level trigger
  or an AFTER row-level trigger is always ignored; it may as well
  be null.

http://www.postgresql.org/docs/8.0/interactive/triggers.html
http://www.postgresql.org/docs/8.0/interactive/plpgsql-trigger.html

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: After Insert or Update Trigger Issues!
Next
From: "Qingqing Zhou"
Date:
Subject: Re: Debugging deadlocks