|
37 | 37 | * |
38 | 38 | * |
39 | 39 | * IDENTIFICATION |
40 | | - * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.110 2003/05/2817:25:02 tgl Exp $ |
| 40 | + * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.111 2003/05/2818:19:09 tgl Exp $ |
41 | 41 | * |
42 | 42 | *------------------------------------------------------------------------- |
43 | 43 | */ |
@@ -410,18 +410,28 @@ errfinish(int dummy, ...) |
410 | 410 | /* |
411 | 411 | * For a FATAL error, we let proc_exit clean up and exit. |
412 | 412 | * |
413 | | - * If we have not yet entered the main backend loop (ie, we are in |
414 | | - * the postmaster or in backend startup), we also go directly to |
415 | | - * proc_exit. The same is true if anyone tries to report an error |
416 | | - * after proc_exit has begun to run. (It's proc_exit's |
417 | | - * responsibility to see that this doesn't turn into infinite |
418 | | - * recursion!)But in the latter case, we exit with nonzero exit |
419 | | - * code to indicate that something's pretty wrong. We also want |
420 | | - * to exit with nonzero exit code if not running under the |
421 | | - * postmaster (for example, if we are being run from the initdb |
422 | | - * script, we'd better return an error status). |
| 413 | + * There are several other cases in which we treat ERROR as FATAL |
| 414 | + * and go directly to proc_exit: |
| 415 | + * |
| 416 | + * 1. ExitOnAnyError mode switch is set (initdb uses this). |
| 417 | + * |
| 418 | + * 2. we have not yet entered the main backend loop (ie, we are in |
| 419 | + * the postmaster or in backend startup); we have noplace to recover. |
| 420 | + * |
| 421 | + * 3. the error occurred after proc_exit has begun to run. (It's |
| 422 | + * proc_exit's responsibility to see that this doesn't turn into |
| 423 | + * infinite recursion!) |
| 424 | + * |
| 425 | + * In the last case, we exit with nonzero exit code to indicate that |
| 426 | + * something's pretty wrong. We also want to exit with nonzero exit |
| 427 | + * code if not running under the postmaster (for example, if we are |
| 428 | + * being run from the initdb script, we'd better return an error |
| 429 | + * status). |
423 | 430 | */ |
424 | | -if (elevel==FATAL|| !Warn_restart_ready||proc_exit_inprogress) |
| 431 | +if (elevel==FATAL|| |
| 432 | +ExitOnAnyError|| |
| 433 | +!Warn_restart_ready|| |
| 434 | +proc_exit_inprogress) |
425 | 435 | { |
426 | 436 | /* |
427 | 437 | * fflush here is just to improve the odds that we get to see |
|