Re: Determine the name of the calling function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jack Kaufman <jack(dot)kaufman(at)sanmina(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Determine the name of the calling function
Date: 2013-01-17 23:43:57
Message-ID: 20165.1358466237@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Jack Kaufman <jack(dot)kaufman(at)sanmina(dot)com> writes:
> How do I programmatically determine, from a sub-function, the name of the
> calling function?

There's not really any built-in way to do that.

If you are sufficiently desperate, I think it'd work to throw an
exception, catch it, and look into the PG_EXCEPTION_CONTEXT text to pull
out the function name the right number of levels up. This is likely to
be expensive though.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Jack Kaufman 2013-01-18 16:28:02 Re: Determine the name of the calling function
Previous Message Jack Kaufman 2013-01-17 22:53:58 Determine the name of the calling function