Re: Determine the name of the calling function

From: Casey Allen Shobe <casey(at)shobe(dot)info>
To: Jack Kaufman <jack(dot)kaufman(at)sanmina(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Determine the name of the calling function
Date: 2013-01-18 16:54:10
Message-ID: CAFmVg3jO6YZj_G_5oVNKq2J3hg8c_tQu3AEGmLTD8MOg0EBOtw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, Jan 18, 2013 at 11:28 AM, Jack Kaufman <jack(dot)kaufman(at)sanmina(dot)com>wrote:

> Our shop is converting to PostgreSQL & PL/pgSQL and we are figuring out
> how to apply the language to our environment. I want to write some API
> functions that will be called from many other functions. I want these
> APIs to log errors to a table and I would like the table entries to include
> the name of the function that called the API. Anyway, that's where I'm
> headed. Thanks for the support.
>

I've personally wanted to raise debug strings from pl/pgsql function saying
what the calling function was (if any) along with other information for
similar reasons - it would make debugging a lot easier. Since you likely
don't only need the the function name in all cases but relevent details
about it such as it's namespace and argument types and probably other
things I'm not thinking of it might be easiest to just be able to find out
the OID of the caller and do the rest on your own as needed. I wonder if
that would be feasible to add.

--
Casey Allen Shobe
casey(at)shobe(dot)info

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Daniel Staal 2013-01-18 17:12:05 Re: Determine the name of the calling function
Previous Message Jack Kaufman 2013-01-18 16:28:02 Re: Determine the name of the calling function