Re: Creating a trigger function

Поиск
Список
Период
Сортировка
От Peter Erickson
Тема Re: Creating a trigger function
Дата
Msg-id hYSdnSx6K8qZk-7dRVn-hA@comcast.com
обсуждение исходный текст
Ответ на Re: Creating a trigger function  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
Richard Huxton wrote:
> On Sunday 04 April 2004 20:40, Peter Erickson wrote:
>
>>Ok, I have determined that i can't do:
>>   IF NEW IS NOT NULL  -- or -- IF OLD IS NOT NULL
>>and that is what is causing the error.
>>
>>So, with this now known, is there a way to create a trigger & function
>>that will allow inserts, updates, and deletes to occur while updating a
>>field (mtime) in another table? At the same time, if an update takes
>>place, it updates the modified time field (mtime) to the current time.
>>
>>I can them all to work individually by modifying the function, but I
>>cant get the to all work in the same function. Do I need to create a
>>trigger for inserts/updates and another for deletes?
>
>
> In plpgsql, there are a number of special TG_XXX variables defined. You want
> to look at TG_OP. See the manuals for details.
>

Thanks. Worked like a charm. I must have glossed over the variables
other than NEW and OLD.

Thanks again.

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

Предыдущее
От: "Daniel A. Steffen"
Дата:
Сообщение: Re: [MACTCL] Tcl load command and mac os x
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: Can we have time based triggers in Postgresql??