From: | Jack Kaufman <jack(dot)kaufman(at)sanmina(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Determine the name of the calling function |
Date: | 2013-01-18 16:28:02 |
Message-ID: | CAM=VM81SrNHq3LS636jxLikY612bKY3jnEjG-gWuDsZSTW0n6g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Tom,
Thank you for your reply. I'll look into the PG_EXCEPTION_CONTEXT
exception text.
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.
Jack
On Thu, Jan 17, 2013 at 6:43 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> 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
>
--
Jack Kaufman
MDS Application Devl (US)
Sanmina-SCI Corporation - Owego site
Email: jack(dot)kaufman(at)sanmina(dot)com
Skype: jack_kaufman_sanm
607-723-0507
CONFIDENTIALITY
This e-mail message and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail message, you are hereby notified that any dissemination, distribution or copying of this e-mail message, and any attachments thereto, is strictly prohibited. If you have received this e-mail message in error, please immediately notify the sender and permanently delete the original and any copies of this email and any prints thereof.
ABSENT AN EXPRESS STATEMENT TO THE CONTRARY HEREINABOVE, THIS E-MAIL IS NOT INTENDED AS A SUBSTITUTE FOR A WRITING. Notwithstanding the Uniform Electronic Transactions Act or the applicability of any other law of similar substance and effect, absent an express statement to the contrary hereinabove, this e-mail message its contents, and any attachments hereto are not intended to represent an offer or acceptance to enter into a contract and are not otherwise intended to bind the sender, Sanmina Corporation (or any of its subsidiaries), or any other person or entity.
From | Date | Subject | |
---|---|---|---|
Next Message | Casey Allen Shobe | 2013-01-18 16:54:10 | Re: Determine the name of the calling function |
Previous Message | Tom Lane | 2013-01-17 23:43:57 | Re: Determine the name of the calling function |