Joshua Kramer wrote:
> 
> Greetings,
> 
> Where in the documentation can I find information on the low-level 
> behavior of triggers that fire as a result of insert/update statements 
> inside of transactions?
> 
> Do the triggers fire at the point the transaction is COMMITted?  Or as 
> soon as the statements are encountered?  (If this is the case, how are 
> rollbacks done - does the trigger also fire for the rollback?)
> 
> I am creating a mechanism for updating PG databases remotely (from another 
> PG database) for a magazine article I'm writing, and I need to figure out 
> how to engineer the trigger mechamisms so they work properly.

These are complex questions.  Triggers fire at the end of the statement,
unless they are DEFERRRED (look that up).  I recommend you look up MVCC
to see how triggers fired on statement end are automatically rolled back
on abort, meaning we don't re-run the triggers on abort, the changes
the trigger made are ignored by other backends.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to