37
37
*
38
38
*
39
39
* IDENTIFICATION
40
- * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.115 2003/07/27 21:49:54 tgl Exp $
40
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.116 2003/08/03 23:44:44 tgl Exp $
41
41
*
42
42
*-------------------------------------------------------------------------
43
43
*/
@@ -318,12 +318,19 @@ errfinish(int dummy, ...)
318
318
MemoryContext oldcontext ;
319
319
ErrorContextCallback * econtext ;
320
320
321
+ recursion_depth ++ ;
321
322
CHECK_STACK_DEPTH ();
322
323
323
324
/*
324
- * Call any context callback functions. We can treat ereports occuring
325
- * in callback functions as re-entrant rather than recursive case, so
326
- * don't increment recursion_depth yet.
325
+ * Do processing in ErrorContext, which we hope has enough reserved space
326
+ * to report an error.
327
+ */
328
+ oldcontext = MemoryContextSwitchTo (ErrorContext );
329
+
330
+ /*
331
+ * Call any context callback functions. Errors occurring in callback
332
+ * functions will be treated as recursive errors --- this ensures we
333
+ * will avoid infinite recursion (see errstart).
327
334
*/
328
335
for (econtext = error_context_stack ;
329
336
econtext != NULL ;
@@ -332,15 +339,6 @@ errfinish(int dummy, ...)
332
339
(* econtext -> callback ) (econtext -> arg );
333
340
}
334
341
335
- /* Now we are ready to process the error. */
336
- recursion_depth ++ ;
337
-
338
- /*
339
- * Do processing in ErrorContext, which we hope has enough reserved space
340
- * to report an error.
341
- */
342
- oldcontext = MemoryContextSwitchTo (ErrorContext );
343
-
344
342
/* Send to server log, if enabled */
345
343
if (edata -> output_to_server )
346
344
send_message_to_server_log (edata );
0 commit comments