Re: trigger envy
От | Stephan Szabo |
---|---|
Тема | Re: trigger envy |
Дата | |
Msg-id | 001501c1a4a0$731fefc0$77de010a@billshaw.com обсуждение исходный текст |
Ответ на | trigger envy (cromwell@softhome.net (cromwell)) |
Список | pgsql-novice |
> Greetings all, i've been reading your postings awhiles now and have come from > complete tyro to aprentice novice reading them :) Its about time for me to start > cutting my teeth on something real, and i'll have to start doing triggers soon > enough for a charity project i'm doing, can anyone give some pointers on what > events i can handle, how i can detect them, and what i can do once i have? You can have triggers run before or after the insert, update or deletion of rows. The trigger will be run once per row affected by the SQL statement. In before triggers you can modify the request being done. For insert or update this allows you to change the row that is going to be placed into the database (modify the tuple you return at the end of the trigger). For all three actions, you may cancel the action on that row (by returning NULL). Before triggers are useful on insert and update for doing modifications like adding timestamp columns and such. In after triggers you can run things that want to see the state of the database after the statement action has occurred (like the row has been inserted, affected rows have been updated, etc...). Our current foreign key support is a special form of after triggers as an example of things that can be done. _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
В списке pgsql-novice по дате отправления: