With postgres, it's possible to get execution information by obtaining the execution stack 1).
In the below function, we:
If you want to extract the full qualified name of the function (ie the schema and the name of the function), you can modify the regular expression with:
function (.*?) line
Create the function that extracts its own schema.
CREATE OR REPLACE FUNCTION my_schema.get_curr_schema()
RETURNS text
LANGUAGE plpgsql
AS
$$
DECLARE
textStack text;
BEGIN
GET DIAGNOSTICS textStack = PG_CONTEXT;
return substring(textStack from 'function (.*)\..*? line');
END;
$$;
select my_schema.get_curr_schema;
my_schema