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

Re: update within trigger function

From: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
To: Mark Steben <msteben(at)autorevenue(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: update within trigger function
Date: 2007-07-23 23:42:36
Message-ID: 20070723234236.GH39272@nasby.net (view raw or flat)
Thread:
Lists: pgsql-admin
On Mon, Jul 23, 2007 at 02:05:20PM -0400, Mark Steben wrote:
> We have 'table a' which has defined to it an 'after insert or update'
> trigger function
> 
> That inserts to 'table b', obviously for every update or insert of table a.
> The challenge
> 
> I have now is to update a new date column on 'table a' with a value coming
> out of
> 
> Another inhouse written function within the trigger function.  But I cannot
> use the UPDATE 
> 
> statement within the update trigger function for fear of an infinite loop.  
> 
> All I need to do is to populate the date field of the row that is currently
> being processed by the trigger function.  
> 
> Is there a command within plpgsql that can help me with this?

See NEW on
http://www.postgresql.org/docs/8.2/interactive/plpgsql-trigger.html
-- 
Jim Nasby                                      decibel(at)decibel(dot)org
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

In response to

pgsql-admin by date

Next:From: Peter KoczanDate: 2007-07-24 00:35:46
Subject: Re: "_" in a serach pattern
Previous:From: De Leeuw GuyDate: 2007-07-23 21:06:47
Subject: trigger bugs ? and suggestions

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