[postgis-users] Automated area calculating

Michael Fuhr mike at fuhr.org
Sun Feb 3 16:51:24 PST 2008


On Sun, Feb 03, 2008 at 11:19:35AM +0100, Johannes Sommer wrote:
> But I still don't know why you have to fire the trigger BEFORE an INSERT OR 
> UPDATE and not AFTER this happens.

An AFTER trigger runs after the insert or update has completed so
it's too late to modify the row except by issuing an UPDATE statement
within the trigger function, which would result in infinite recursion
if the UPDATE fired the trigger again.  AFTER triggers are suitable
for propogating the row to other tables when you need to be certain
of seeing the final value.  If you want to modify the row being
inserted or updated then you need to use a BEFORE trigger.

-- 
Michael Fuhr



More information about the postgis-users mailing list