Hi!

Sorry if I post this mail to the wrong list, I checked each by it's 
theme and this seems to be the best.
I have a strange problem with an errorcontextcallback:
Given the following code fragment:
                mycallback->previous = error_context_stack;
                elog(DEBUG1,"1");
                mycallback->callback = plpgj_ErrorContextCallback;
                elog(DEBUG1,"2");
                mycallback->arg = "hello world!";
                elog(DEBUG1,"3");
                error_context_stack = mycallback;
                elog(DEBUG1,"4");

and the callback function logs "callback", the following apears in the log:
DEBUG:  1
DEBUG:  2
DEBUG:  3
ERROR:  callback

Can anybody tell me why this happens?

Thanks,
Laszlo
Mon, 09 Aug 2004 23:42:39 +0200
Laszlo Hornyak <kocka@forgeahead.hu>
ErrorContextCallback
Laszlo Hornyak <kocka@forgeahead.hu> writes:
> and the callback function logs "callback", the following apears in the log:
> ERROR:  callback

> Can anybody tell me why this happens?

Sure you didn't "elog(ERROR)" rather than "elog(LOG)" inside the
callback function?

In any case, you can't expect useful help without showing us the
callback function.

			regards, tom lane

Tue, 10 Aug 2004 14:15:22 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: ErrorContextCallback 
On Mon, 9 Aug 2004, Laszlo Hornyak wrote:

> Hi!
>
> Sorry if I post this mail to the wrong list, I checked each by it's
> theme and this seems to be the best.
> I have a strange problem with an errorcontextcallback:
> Given the following code fragment:
>                 mycallback->previous = error_context_stack;
>                 elog(DEBUG1,"1");
>                 mycallback->callback = plpgj_ErrorContextCallback;
>                 elog(DEBUG1,"2");
>                 mycallback->arg = "hello world!";
>                 elog(DEBUG1,"3");
>                 error_context_stack = mycallback;

Its only at the lijne above that you're updating error_context_stack.

>                 elog(DEBUG1,"4");

Every call to elog() (errfinish), calls the callbacks registered in
error_context_stack, if my memory serves me correctly.

It might not be relevant to the problem you're solving, but have you
looked at Tom's try/catch code in HEAD?

Gavin

Wed, 11 Aug 2004 07:31:45 +1000 (EST)
Gavin Sherry <swm@linuxworld.com.au>
Re: ErrorContextCallback