Re: Question on triggers and plpgsql

Поиск
Список
Период
Сортировка
От John DeSoi
Тема Re: Question on triggers and plpgsql
Дата
Msg-id 51899A9B-A838-11D9-9125-000A95B03262@pgedit.com
обсуждение исходный текст
Ответ на Re: Question on triggers and plpgsql  (Sean Davis <sdavis2@mail.nih.gov>)
Список pgsql-sql
On Apr 8, 2005, at 9:41 AM, Sean Davis wrote:

> Just one detail, but in the form of a question. In the original 
> posting, I think the trigger was doing the logging for something 
> happening on a table as a before insert or update--I may be wrong on 
> that detail.  I would think of doing such actions AFTER the 
> update/insert.  In the world of transaction-safe operations, is there 
> ANY danger in doing the logging as a BEFORE trigger rather than an 
> AFTER trigger?


Good point. I think both will work in this case and it would depend on 
the application if it makes a difference. You definitely want an AFTER 
trigger if you need to see the final state of the row before making 
changes. In this case the assignment of the column does not depend on 
any other factors so it would not seem to matter. But I agree from a 
semantics point of view, an AFTER trigger might be a little better for 
this.

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL



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

Предыдущее
От: Sean Davis
Дата:
Сообщение: Re: Question on triggers and plpgsql
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Question on triggers and plpgsql