Re: Determine the name of the calling function

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 19:35:08
Message-ID: CAM=VM83UZy_8EQDG5jOEEBN4x6qHuSYFu9Btr1CjF3QMU1QpAw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Tom, a "calling-function-name" parameter to the API may be the best
solution I'm going to get with PL/pgSQL. Thanks for the suggestion.

By the way, PG_EXCEPTION_CONTEXT provided only the (currently executing)
API function name and line number of the exception (where I caused a
divide-by-zero). No function-call stack. :( But thanks, anyway.

Jack

On Fri, Jan 18, 2013 at 12:32 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Jack Kaufman <jack(dot)kaufman(at)sanmina(dot)com> writes:
> > 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.
>
> Hm ... if you're going to be translating anyway, why not just add the
> caller's function name as an explicit parameter?
>
> 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.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Jack Kaufman 2013-01-18 19:45:15 Re: Determine the name of the calling function
Previous Message Tom Lane 2013-01-18 17:32:55 Re: Determine the name of the calling function