After insert trigger question - Mailing list pgsql-general

From mmiranda@americatel.com.sv
Subject After insert trigger question
Date
Msg-id 76E0DAA32C39D711B6EC0002B364A6FA0440F815@amsal01exc01.americatel.com.sv
Whole thread Raw
Responses Re: After insert trigger question  (Stephane Bortzmeyer <bortzmeyer@nic.fr>)
List pgsql-general
Hi ppl,
i have a specific question about insert triggers, in the docs i found that
you can change the value of an inserted column using the following syntax:

NEW.column_name := value

and then if you return NEW the new value is stored instead of the original.
this is true if it is a before insert trigger.
The manual also says that the return value of an after insert trigger is
ignored, that means that you cannot update the value of a column in the same
way with an after insert trigger?.
I am concerned about how reliable is an before insert trigger, i made some
computation in my trigger and i want that no matter what happens inside  the
trigger (exceptions, erros, divide by zero, etc) , the row must be inserted,
i mean if the trigger fails,  i always have the row in my table.
Because of that, i think after insert trigger is the best option, beacuse is
fired after the data is in the table, am i wrong?
thanks

pgsql-general by date:

Previous
From: Sebastian Böck
Date:
Subject: Re: PRIMARY KEY on a *group* of columns imply that each
Next
From: Stephane Bortzmeyer
Date:
Subject: Re: PRIMARY KEY on a *group* of columns imply that each column is NOT