pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yudha Setiawan <yudha@BonBon.net>
To: pgsql-admin@postgresql.org
Subject: How to avoid the Mutating Triggers ??
Date: Wed, 19 Feb 2003 19:59:22 +0700
Message-ID: <01c801c2d81a$414f4aa0$ea00a8c0@yudha> (raw)

Dear Master,
I've some problem with this situation.
It's hard to explain what kind of
problem is, but i try to tell you 
with my limitation on english.

How do I "recalculate" one of
my field, if i updated one of
the record that's have position
in the middle of all record.
Here my Ilustration is;
----------------------------------------
Poin-|FdDate     | Code| IN  |OUT| Qty |
ter. |----------------------------------
1    |01/01/2003 | 001 |  5  | 0 |   5 | 
2    |01/02/2003 | 001 |  3  | 0 |   8 |
3    |01/03/2003 | 001 |  0  | 1 |   7 |
4    |01/06/2003 | 001 | 100 | 0 | 117 |
5    |00107/2003 | 001 |  0  | 1 | 118 |
6    |00108/2003 | 001 |  0  | 1 | 119 |
7    |00109/2003 | 001 |  0  | 1 | 120 |
----------------------------------------
And what i want is, update the record 
on Pointer no 4. on "IN" is changed from
100 to 10 And Qty is Automaticly change
from 117 to 17. like this;
----------------------------------------
Poin-|FdDate     | Code| IN  |OUT| Qty |
ter. |----------------------------------
4    |01/06/2003 | 001 | 10  | 0 |  17 |
----------------------------------------
Following with record below it, and become 
like this;
----------------------------------------
Poin-|FdDate     | Code| IN  |OUT| Qty |
ter. |----------------------------------
5    |00107/2003 | 001 | 0  | 1 |  18  |
6    |00108/2003 | 001 | 0  | 1 |  19  |
7    |00109/2003 | 001 | 0  | 1 |  20  |
----------------------------------------

I've been trying using cursor inside of
my trigger, It didn't work and it's 
"mutating". i thought my trigger is 
working recursive. It's very Urgent 
for me. I've been migrating Database 
from Ms-SQL, so far so great, till 
this Problem I've been spending my 
3 Days with No-Result. 
It's time to Give-up. 
So gimme your hand please...???

Thank's to you and, 
GOD Bless You All.

Yudha Setiawan.
VoIP 
    No.        : 628899911223344

view thread (4+ messages)  latest in thread

Message-ID: <01c801c2d81a$414f4aa0$ea00a8c0@yudha>
Permalink:  ../01c801c2d81a$414f4aa0$ea00a8c0@yudha/
Also on:    postgresql.org/message-id/01c801c2d81a$414f4aa0$ea00a8c0@yudha

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: yudha@BonBon.net
  Subject: Re: How to avoid the Mutating Triggers ??
  In-Reply-To: <01c801c2d81a$414f4aa0$ea00a8c0@yudha>
  References: <01c801c2d81a$414f4aa0$ea00a8c0@yudha>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox