Re: Trigger function that works with both updates and deletes?
В списке pgsql-general по дате отправления:
| От | Michael Fuhr |
|---|---|
| Тема | Re: Trigger function that works with both updates and deletes? |
| Дата | |
| Msg-id | 20070619013659.GA16834@winnie.fuhr.org обсуждение исходный текст |
| Ответ на | Trigger function that works with both updates and deletes? (novnov <novnovice@gmail.com>) |
| Ответы |
Re: Trigger function that works with both updates and
deletes?
|
| Список | pgsql-general |
On Mon, Jun 18, 2007 at 06:07:37PM -0700, novnov wrote: > First, when a record is being deleted, OLD refers to the rec just deleted > (or about to be deleted)? Correct. > Second, while I could write two trigger functions, one dealing with > add/update, the other with deletes, it's probably neater to have a single > trigger function and have it discriminate "am I being called for a delete, > or an add/update?" I don't know how to determine the type record change. In PL/pgSQL you can use TG_OP. See "Trigger Procedures" in the documentation: http://www.postgresql.org/docs/8.2/interactive/plpgsql-trigger.html -- Michael Fuhr
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера