Is there a way to get name of the function/procedure, which contains query, which caused a TRIGGER
to activate?
For example I have function update_user_whatever
and it updates user data and I want to log updates to user table with the knowledge of which function caused it (and preferably with its arguments).
-- untested illustrative example:
CREATE FUNCTION update_user_whatever(param int) RETURNS user AS $$
UPDATE user_table SET attr=$1 RETURNING *
$$ LANGUAGE SQL;
Now can the trigger which is executed on UPDATE
when running this function access the name on the function? (in this case update_user_whatever
)
Or is this a wrong way of looking at the problem and a different approach should be chosen?