> Ok, find attached a script called test.sql that will create three tables > called parent, child, and totals. It will create a simple AFTER UPDATE > trigger on child and a BEFORE trigger on parent simply to show that the > values of batch and chkno are set to NULL right in the beginning. Just load > the thing in with the \i command. There is a function created called > myfunc(int). Simply do: SELECT myfunc(99); to see what happens. After you > execute the function, you will find that parent.total is zero, > child.apply_amt for each record is zero, but totals is still set to 1500. It > should be 1000. > > Version info: > rnd=# select version(); > version > -------------------------------------------------------------------------------------------------------------- > PostgreSQL 7.4.6 on i686-redhat-linux-gnu, compiled by GCC gcc (GCC) 3.2.3 > 20030502 (Red Hat Linux 3.2.3-49) > (1 row) > > Any insight is appreciated. I think in 8.0 or later it'd do what you want, however IIRC in 7.4 the after triggers are delayed until after the full execution of the function myfunc (ie, at the end of the outer statement).