From: | mmiranda(at)americatel(dot)com(dot)sv |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | After insert trigger question |
Date: | 2005-04-27 14:45:44 |
Message-ID: | 76E0DAA32C39D711B6EC0002B364A6FA0440F815@amsal01exc01.americatel.com.sv |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Sebastian Böck | 2005-04-27 14:50:23 | Re: PRIMARY KEY on a *group* of columns imply that each |
Previous Message | Scott Marlowe | 2005-04-27 14:36:57 | Re: PRIMARY KEY on a *group* of columns imply that each |