77 * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
88 * Portions Copyright (c) 1994, Regents of the University of California
99 *
10- * $Id: elog.h,v 1.19 2000/12/03 10:27:29 vadim Exp $
10+ * $Id: elog.h,v 1.20 2000/12/06 17:25:45 tgl Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
1414#ifndef ELOG_H
1515#define ELOG_H
1616
17- #include "miscadmin.h"
18-
1917#define NOTICE 0/* random info - no special action */
2018#define ERROR (-1)/* user error - return to known state */
2119#define FATAL 1/* fatal error - abort process */
@@ -30,23 +28,29 @@ extern int Use_syslog;
3028#endif
3129
3230/*
33- * If StopIfError > 0 signal handlersdon 't do
34- * elog(ERROR|FATAL) but remember what actionwas
35- * required with QueryCancel & ExitAfterAbort
31+ * If StopIfError > 0 signal handlersmustn 't do
32+ * elog(ERROR|FATAL), instead remember what actionis
33+ * required with QueryCancel & ExitAfterAbort.
3634 */
35+ extern uint32 StopIfError ;/* duplicates access/xlog.h */
36+ extern bool QueryCancel ;/* duplicates miscadmin.h */
3737extern bool ExitAfterAbort ;
38- #define START_CRIT_CODE StopIfError++
39- #define END_CRIT_CODE \
40- if (!StopIfError)\
41- elog(STOP, "Not in critical section");\
42- StopIfError--;\
43- if (!StopIfError && QueryCancel)\
44- {\
45- if (ExitAfterAbort)\
46- elog(FATAL, "The system is shutting down");\
47- else\
48- elog(ERROR, "Query was cancelled.");\
49- }
38+
39+ #define START_CRIT_CODE (StopIfError++)
40+
41+ #define END_CRIT_CODE \
42+ do { \
43+ if (!StopIfError) \
44+ elog(STOP, "Not in critical section"); \
45+ StopIfError--; \
46+ if (!StopIfError && QueryCancel) \
47+ { \
48+ if (ExitAfterAbort) \
49+ elog(FATAL, "The system is shutting down"); \
50+ else \
51+ elog(ERROR, "Query was cancelled."); \
52+ } \
53+ } while(0)
5054
5155extern bool Log_timestamp ;
5256extern bool Log_pid ;