|
7 | 7 | * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
8 | 8 | * Portions Copyright (c) 1994, Regents of the University of California
|
9 | 9 | *
|
10 |
| - * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.94 2008/09/01 20:42:45 tgl Exp $ |
| 10 | + * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.95 2008/10/09 17:24:05 alvherre Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
|
92 | 92 | * ERRCODE_INTERNAL_ERROR if elevel is ERROR or more, ERRCODE_WARNING
|
93 | 93 | * if elevel is WARNING, or ERRCODE_SUCCESSFUL_COMPLETION if elevel is
|
94 | 94 | * NOTICE or below.
|
| 95 | + * |
| 96 | + * ereport_domain() allows a message domain to be specified, for modules that |
| 97 | + * wish to use a different message catalog from the backend's.To avoid having |
| 98 | + * one copy of the default text domain per .o file, we define it as NULL here |
| 99 | + * and have errstart insert the default text domain. Modules can either use |
| 100 | + * ereport_domain() directly, or preferrably they can override the TEXTDOMAIN |
| 101 | + * macro. |
95 | 102 | *----------
|
96 | 103 | */
|
97 |
| -#defineereport(elevel,rest)\ |
98 |
| -(errstart(elevel, __FILE__, __LINE__, PG_FUNCNAME_MACRO) ? \ |
| 104 | +#defineereport_domain(elevel,domain,rest)\ |
| 105 | +(errstart(elevel, __FILE__, __LINE__, PG_FUNCNAME_MACRO, domain) ? \ |
99 | 106 | (errfinish rest) : (void) 0)
|
100 | 107 |
|
| 108 | +#defineereport(level,rest)\ |
| 109 | +ereport_domain(level, TEXTDOMAIN, rest) |
| 110 | + |
| 111 | +#defineTEXTDOMAIN NULL |
| 112 | + |
101 | 113 | externboolerrstart(intelevel,constchar*filename,intlineno,
|
102 |
| -constchar*funcname); |
| 114 | +constchar*funcname,constchar*domain); |
103 | 115 | externvoiderrfinish(intdummy,...);
|
104 | 116 |
|
105 | 117 | externinterrcode(intsqlerrcode);
|
@@ -269,6 +281,7 @@ typedef struct ErrorData
|
269 | 281 | constchar*filename;/* __FILE__ of ereport() call */
|
270 | 282 | intlineno;/* __LINE__ of ereport() call */
|
271 | 283 | constchar*funcname;/* __func__ of ereport() call */
|
| 284 | +constchar*domain;/* message domain, NULL if default */ |
272 | 285 | intsqlerrcode;/* encoded ERRSTATE */
|
273 | 286 | char*message;/* primary error message */
|
274 | 287 | char*detail;/* detail error message */
|
|