Re: Trigger question - Mailing list pgsql-general

From Tom Lane
Subject Re: Trigger question
Date
Msg-id 11210.975344605@sss.pgh.pa.us
Whole thread Raw
In response to Trigger question  (Nelio Alves Pereira Filho <nelio@ifx.com.br>)
List pgsql-general
Nelio Alves Pereira Filho <nelio@ifx.com.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

pgsql-general by date:

Previous
From: Nelio Alves Pereira Filho
Date:
Subject: Trigger question
Next
From: Nelio Alves Pereira Filho
Date:
Subject: Re: Trigger question