diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-08-03 23:44:44 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-08-03 23:44:44 +0000 |
commit | c1c7b338eebe986dfa50da8a99b804ccc4e85160 (patch) | |
tree | 7dd0a55d6fe74f3ae3ed698c859ed8bf8ae4c3b7 /src | |
parent | 0b96badc9c5fa9fba32531bea2058caeb4eb1757 (diff) | |
download | postgresql-c1c7b338eebe986dfa50da8a99b804ccc4e85160.tar.gz postgresql-c1c7b338eebe986dfa50da8a99b804ccc4e85160.zip |
Reconsider context for calling callback functions --- original idea
that they aren't part of error processing is clearly faulty.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/error/elog.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 33b2a720491..a8d29840095 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -37,7 +37,7 @@ * * * 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; ErrorContextCallback *econtext; + recursion_depth++; CHECK_STACK_DEPTH(); /* - * Call any context callback functions. We can treat ereports occuring - * in callback functions as re-entrant rather than recursive case, so - * don't increment recursion_depth yet. + * Do processing in ErrorContext, which we hope has enough reserved space + * to report an error. + */ + 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; econtext != NULL; @@ -332,15 +339,6 @@ errfinish(int dummy, ...) (*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 */ if (edata->output_to_server) send_message_to_server_log(edata); |