Search Postgresql Archives

Re: Order of Update - Second Try

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stephan,

Thanks for the reply. We will be upgrading to version 8.x in the third quarter 
of the year. As I said, I have a workaround. I just wanted to know why it was 
behaving that way and you provided that. Thanks for the help.

On Tuesday 21 March 2006 11:36 am, Stephan Szabo saith:
> > 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).
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
>        message can get through to the mailing list cleanly

-- 
Quote: 71
"When the Lord calls me home, whenever that may be, I will leave with
 the greatest love for this country of ours and eternal optimism for
 its future. I now begin the journey that will lead me into the sunset
 of my life. I know that for America there will always be a bright dawn
 ahead."

 --Ronald Reagan

 Work: 1-336-372-6812
 Cell: 1-336-363-4719
email: terry@xxxxxxxx


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux