Re: After Insert or Update Trigger Issues!

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Kyrill Alyoshin <kyrill(at)technolog(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org, Gill Hauer <gilh(at)technolog(dot)ca>
Subject: Re: After Insert or Update Trigger Issues!
Date: 2005-03-28 02:06:58
Message-ID: 20050328020658.GA60315@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Qingqing Zhou 2005-03-28 02:11:42 Re: Debugging deadlocks
Previous Message Tom Lane 2005-03-28 02:01:52 Re: After Insert or Update Trigger Issues!