Re: Can a nested function determine it is being called within a trigger?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Can a nested function determine it is being called within a trigger?
Дата
Msg-id 14640.1302910589@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Can a nested function determine it is being called within a trigger?  (Basil Bourque <basil.list@me.com>)
Ответы Re: Can a nested function determine it is being called within a trigger?  (Rob Sargent <robjsargent@gmail.com>)
Список pgsql-general
Basil Bourque <basil.list@me.com> writes:
> When a trigger calls a function, that function can determine if it is being called from within a trigger by testing
fora value in the special variable "TG_OP". 

Uh, no, not really.  TG_OP is a local variable in the trigger function;
it's not visible from elsewhere.

> But what if a trigger calls a function that calls a 2nd function via the "PERFORM" command? Can that 2nd function
tellif it is being run in a trigger? 

No.  Doesn't really matter whether you use PERFORM or not.

            regards, tom lane

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

Предыдущее
От: "Henry C."
Дата:
Сообщение: Re: Replication: slave is in permanent startup 'recovery'
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: Can a nested function determine it is being called within a trigger?