pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
update within trigger function
2+ messages / 2 participants
[nested] [flat]

* update within trigger function
@ 2007-07-23 18:05  Mark Steben <msteben@autorevenue.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Mark Steben @ 2007-07-23 18:05 UTC (permalink / raw)
  To: pgsql-admin

Hello listers,

 

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?

 

This seems like an elementary question, but I am a very elementary user of

Postgres functions.  Thank you for your time,

 

Mark Steben

Senior Database Administrator
@utoRevenueT 
A Dominion Enterprises Company
480 Pleasant Street
Suite B200
Lee, MA 01238
413-243-4800 Home Office 
413-243-4809 Corporate Fax

msteben <blocked::mailto:name@autorevenue.com> @autorevenue.com

Visit our new website at 
 <blocked::http://www.autorevenue.com/; www.autorevenue.com

 

IMPORTANT: The information contained in this e-mail message is confidential
and is intended only for the named addressee(s). If the reader of this
e-mail message is not the intended recipient (or the individual responsible
for the delivery of this e-mail message to the intended recipient), please
be advised that any re-use, dissemination, distribution or copying of this
e-mail message is prohibited.  If you have received this e-mail message in
error, please reply to the sender that you have received this e-mail message
in error and then delete it.  Thank you.

 

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: update within trigger function
@ 2007-07-23 23:42  Jim C. Nasby <decibel@decibel.org>
  parent: Mark Steben <msteben@autorevenue.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Jim C. Nasby @ 2007-07-23 23:42 UTC (permalink / raw)
  To: Mark Steben <msteben@autorevenue.com>; +Cc: 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@decibel.org
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-07-23 23:42 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-23 18:05 update within trigger function Mark Steben <msteben@autorevenue.com>
2007-07-23 23:42 ` Jim C. Nasby <decibel@decibel.org>

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