À partir de Postgres 9.4, la fonction ci-dessous renverra son propre nom :
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;