After insert trigger question

Поиск
Список
Период
Сортировка
От mmiranda@americatel.com.sv
Тема After insert trigger question
Дата
Msg-id 76E0DAA32C39D711B6EC0002B364A6FA0440F815@amsal01exc01.americatel.com.sv
обсуждение исходный текст
Ответы Re: After insert trigger question  (Stephane Bortzmeyer <bortzmeyer@nic.fr>)
Список 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 по дате отправления:

Предыдущее
От: Sebastian Böck
Дата:
Сообщение: Re: PRIMARY KEY on a *group* of columns imply that each
Следующее
От: Stephane Bortzmeyer
Дата:
Сообщение: Re: PRIMARY KEY on a *group* of columns imply that each column is NOT