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

From: Basil Bourque <basil(dot)list(at)me(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Can a nested function determine it is being called within a trigger?
Date: 2011-04-15 22:29:28
Message-ID: D0A4B03B-9374-4F7E-A775-84C194BEE3FC@me.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

When a trigger calls a function, that function can determine if it is being called from within a trigger by testing for a value in the special variable "TG_OP".

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

Trigger --> Function_A --> Function_B

--Basil Bourque

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2011-04-15 22:58:40 Re: Help: pg_restore failure
Previous Message Tom Lane 2011-04-15 20:33:30 Re: Vacuumdb error