mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-06 15:24:56 +08:00
Reconsider context for calling callback functions --- original idea
that they aren't part of error processing is clearly faulty.
This commit is contained in:
parent
0b96badc9c
commit
c1c7b338ee
@ -37,7 +37,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.115 2003/07/27 21:49:54 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.116 2003/08/03 23:44:44 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -318,12 +318,19 @@ errfinish(int dummy, ...)
|
|||||||
MemoryContext oldcontext;
|
MemoryContext oldcontext;
|
||||||
ErrorContextCallback *econtext;
|
ErrorContextCallback *econtext;
|
||||||
|
|
||||||
|
recursion_depth++;
|
||||||
CHECK_STACK_DEPTH();
|
CHECK_STACK_DEPTH();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call any context callback functions. We can treat ereports occuring
|
* Do processing in ErrorContext, which we hope has enough reserved space
|
||||||
* in callback functions as re-entrant rather than recursive case, so
|
* to report an error.
|
||||||
* don't increment recursion_depth yet.
|
*/
|
||||||
|
oldcontext = MemoryContextSwitchTo(ErrorContext);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Call any context callback functions. Errors occurring in callback
|
||||||
|
* functions will be treated as recursive errors --- this ensures we
|
||||||
|
* will avoid infinite recursion (see errstart).
|
||||||
*/
|
*/
|
||||||
for (econtext = error_context_stack;
|
for (econtext = error_context_stack;
|
||||||
econtext != NULL;
|
econtext != NULL;
|
||||||
@ -332,15 +339,6 @@ errfinish(int dummy, ...)
|
|||||||
(*econtext->callback) (econtext->arg);
|
(*econtext->callback) (econtext->arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now we are ready to process the error. */
|
|
||||||
recursion_depth++;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Do processing in ErrorContext, which we hope has enough reserved space
|
|
||||||
* to report an error.
|
|
||||||
*/
|
|
||||||
oldcontext = MemoryContextSwitchTo(ErrorContext);
|
|
||||||
|
|
||||||
/* Send to server log, if enabled */
|
/* Send to server log, if enabled */
|
||||||
if (edata->output_to_server)
|
if (edata->output_to_server)
|
||||||
send_message_to_server_log(edata);
|
send_message_to_server_log(edata);
|
||||||
|
Loading…
Reference in New Issue
Block a user