this is close as you get and it won't work in nested calls.
select current_query from pg_stat_activity where procpid = pg_backend_pid ();
You might want to email pgsql-hackers@postgresql.org a feature request, including the use case you want to know this information.
a source
to share