Re: [SQL] Triggers

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] Triggers
Дата
Msg-id 13258.947001311@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Triggers  ("Mitch Vincent" <mitch@venux.net>)
Список pgsql-sql
"Mitch Vincent" <mitch@venux.net> writes:
> I'm using this funtion via a trigger to total up amounts in several fields
> (and adding that value into a total field)..

> CREATE TRIGGER invoice_total_trigger AFTER INSERT OR UPDATE ON invoice
> FOR EACH ROW EXECUTE PROCEDURE invoice_total_trigger();

> It works for updating but not when you insert a new row. Am I doing it
> wrong?

Er, don't you want BEFORE INSERT OR UPDATE?

I wouldn't think an AFTER trigger could modify the already-inserted-or-
updated row...
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Mitch Vincent"
Дата:
Сообщение: Triggers
Следующее
От: "Mitch Vincent"
Дата:
Сообщение: Re: [SQL] Triggers