Is there anyway from within a plpgsql function that you can get the name of the function? Or even the OID of the function?
I know there are some \"special\" variab
As of Postgres 9.4, the below function will return its own name:
CREATE OR REPLACE FUNCTION your_schema.get_curr_fx_name()
RETURNS text AS $$
DECLARE
stack text; fcesig text;
BEGIN
GET DIAGNOSTICS stack = PG_CONTEXT;
fcesig := substring(stack from 'function (.*?) line');
RETURN fcesig::regprocedure::text;
END;
$$ LANGUAGE plpgsql;