From: | Nelio Alves Pereira Filho <nelio(at)ifx(dot)com(dot)br> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Trigger question |
Date: | 2000-11-27 17:08:36 |
Message-ID: | 3A229514.2241079A@ifx.com.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I got it.
But here's what I need to do: after any modification on the table, I
must run a procedure that will do some calculation, and then set these
values for each row. This calculation establishes relationships between
rows, and builds logically a tree. To accomplish all that, first I need
to unset some values, so I decided to use the BEFORE trigger to unset
these values, and the AFTER trigger to do this calculation.
Will I have to use explicit queries? And what's the real purpose of the
AFTER trigger?
Thanks
Tom Lane wrote:
>
> Nelio Alves Pereira Filho <nelio(at)ifx(dot)com(dot)br> writes:
> > create trigger set_counter after insert or update on nivel
> > for each row execute procedure set_counter();
>
> > The problem is that after I insert something, count value is still -1,
> > not 0!
>
> You want a BEFORE trigger, not an AFTER trigger. AFTER is too late
> to affect the contents of the stored row.
>
> regards, tom lane
--
Nelio Alves Pereira Filho
IFX Networks
Sao Paulo / Brazil
From | Date | Subject | |
---|---|---|---|
Next Message | Marko Kreen | 2000-11-27 17:16:51 | Re: Re: [GENERAL] Warning: Don't delete those /tmp/.PGSQL.* files |
Previous Message | Tom Lane | 2000-11-27 17:03:25 | Re: Trigger question |