Re: Order of Update - Second Try - Mailing list pgsql-general

From Terry Lee Tucker
Subject Re: Order of Update - Second Try
Date
Msg-id 200603211115.16809.terry@esc1.com
Whole thread Raw
In response to Re: Order of Update - Second Try  (Terry Lee Tucker <terry@esc1.com>)
Responses Re: Order of Update - Second Try  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-general
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.
TIA

On Tuesday 21 March 2006 09:11 am, Terry Lee Tucker saith:
> Thanks for the response. I'm working on a simplified example now. It will
> take a little time to set it up.  I will post all the code for creating the
> much simplified tables and trigger.
>
> Again, thanks for the response...
>
> On Tuesday 21 March 2006 08:15 am, Martijn van Oosterhout saith:
> > On Tue, Mar 21, 2006 at 06:56:23AM -0500, Terry Lee Tucker wrote:
> > > Hello List:
> > >
> > > I posted a question over the weekend regarding this issue but I failed
> > > to communicate effectively what the problem is. I was weary :o[  Let me
> > > try again.
> >
> > I think one of the reasons why you're not getting any responses is that
> > the problem is complicated but you have not provided a complete
> > example. You don't for example say how the trigger is defined
> > (BEFORE|AFTER) (ROW|STATEMENT) DEFERRED yes/no? If you really want an
> > answer you're going to need to provide a complete example people can
> > run on their own systems.
> >
> > have a nice day,
>
> --
> Quote: 39
> "Posterity -- you will never know how much it has cost my generation
>  to preserve your freedom. I hope you will make good use of it."
>
>  --John Quincy Adams
>
>  Work: 1-336-372-6812
>  Cell: 1-336-363-4719
> email: terry@esc1.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

Attachment

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: What's a good default encoding?
Next
From: "Shulman, Michael"
Date:
Subject: Connection error