Laszlo Hornyak <kocka@forgeahead.hu> writes:
> I have a error callback function registered to run each time an SQL
> error occurs. The problem is that the errfinish() calls it both if the
> executed SQL statement was wrong, and if the statem,ent or plan logging
> is enabled, and it seems elog.h doesn't provide the API to find out the
> reason why my callback was called.
I suspect you are abusing the callback mechanism to do something it was
not intended for. Callbacks are supposed to supply information for the
error message context field, *and nothing else*. You'll probably break
things if you go outside that charter. Accordingly, I see no reason why
a callback should care why it was called.
What are you trying to accomplish, really?
regards, tom lane