PostgreSQL Source Code git master
Loading...
Searching...
No Matches
elog.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * elog.h
4 * POSTGRES error reporting/logging definitions.
5 *
6 *
7 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/utils/elog.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef ELOG_H
15#define ELOG_H
16
17#include <setjmp.h>
18
19#include "lib/stringinfo.h"
20
21/* We cannot include nodes.h yet, so forward-declare struct Node */
22struct Node;
23
24
25/* Error level codes */
26#define LOG_NEVER 0 /* Never emit this message */
27#define DEBUG5 10 /* Debugging messages, in categories of
28 * decreasing detail. */
29#define DEBUG4 11
30#define DEBUG3 12
31#define DEBUG2 13
32#define DEBUG1 14 /* used by GUC debug_* variables */
33#define LOG 15 /* Server operational messages; sent only to
34 * server log by default. */
35#define LOG_SERVER_ONLY 16 /* Same as LOG for server reporting, but never
36 * sent to client. */
37#define COMMERROR LOG_SERVER_ONLY /* Client communication problems; same as
38 * LOG for server reporting, but never
39 * sent to client. */
40#define INFO 17 /* Messages specifically requested by user (eg
41 * VACUUM VERBOSE output); always sent to
42 * client regardless of client_min_messages,
43 * but by default not sent to server log. */
44#define NOTICE 18 /* Helpful messages to users about query
45 * operation; sent to client and not to server
46 * log by default. */
47#define WARNING 19 /* Warnings. NOTICE is for expected messages
48 * like implicit sequence creation by SERIAL.
49 * WARNING is for unexpected messages. */
50#define PGWARNING 19 /* Must equal WARNING; see NOTE below. */
51#define WARNING_CLIENT_ONLY 20 /* Warnings to be sent to client as usual, but
52 * never to the server log. */
53#define ERROR 21 /* user error - abort transaction; return to
54 * known state */
55#define PGERROR 21 /* Must equal ERROR; see NOTE below. */
56#define FATAL 22 /* fatal error - abort process */
57#define FATAL_CLIENT_ONLY 23 /* fatal version of WARNING_CLIENT_ONLY */
58#define PANIC 24 /* take down the other backends with me */
59
60/*
61 * NOTE: the alternate names PGWARNING and PGERROR are useful for dealing
62 * with third-party headers that make other definitions of WARNING and/or
63 * ERROR. One can, for example, re-define ERROR as PGERROR after including
64 * such a header.
65 */
66
67
68/* macros for representing SQLSTATE strings compactly */
69#define PGSIXBIT(ch) (((ch) - '0') & 0x3F)
70#define PGUNSIXBIT(val) (((val) & 0x3F) + '0')
71
72#define MAKE_SQLSTATE(ch1,ch2,ch3,ch4,ch5) \
73 (PGSIXBIT(ch1) + (PGSIXBIT(ch2) << 6) + (PGSIXBIT(ch3) << 12) + \
74 (PGSIXBIT(ch4) << 18) + (PGSIXBIT(ch5) << 24))
75
76/* These macros depend on the fact that '0' becomes a zero in PGSIXBIT */
77#define ERRCODE_TO_CATEGORY(ec) ((ec) & ((1 << 12) - 1))
78#define ERRCODE_IS_CATEGORY(ec) (((ec) & ~((1 << 12) - 1)) == 0)
79
80/* SQLSTATE codes for errors are defined in a separate file */
81#include "utils/errcodes.h"
82
83/*
84 * Provide a way to prevent "errno" from being accidentally used inside an
85 * elog() or ereport() invocation. Since we know that some operating systems
86 * define errno as something involving a function call, we'll put a local
87 * variable of the same name as that function in the local scope to force a
88 * compile error. On platforms that don't define errno in that way, nothing
89 * happens, so we get no warning ... but we can live with that as long as it
90 * happens on some popular platforms.
91 */
92#if defined(errno) && defined(__linux__)
93#define pg_prevent_errno_in_scope() int __errno_location pg_attribute_unused()
94#elif defined(errno) && (defined(__darwin__) || defined(__FreeBSD__))
95#define pg_prevent_errno_in_scope() int __error pg_attribute_unused()
96#else
97#define pg_prevent_errno_in_scope()
98#endif
99
100
101/*----------
102 * New-style error reporting API: to be used in this way:
103 * ereport(ERROR,
104 * errcode(ERRCODE_UNDEFINED_CURSOR),
105 * errmsg("portal \"%s\" not found", stmt->portalname),
106 * ... other errxxx() fields as needed ...);
107 *
108 * The error level is required, and so is a primary error message (errmsg
109 * or errmsg_internal). All else is optional. errcode() defaults to
110 * ERRCODE_INTERNAL_ERROR if elevel is ERROR or more, ERRCODE_WARNING
111 * if elevel is WARNING, or ERRCODE_SUCCESSFUL_COMPLETION if elevel is
112 * NOTICE or below.
113 *
114 * Before Postgres v12, extra parentheses were required around the
115 * list of auxiliary function calls; that's now optional.
116 *
117 * ereport_domain() allows a message domain to be specified, for modules that
118 * wish to use a different message catalog from the backend's. To avoid having
119 * one copy of the default text domain per .o file, we define it as NULL here
120 * and have errstart insert the default text domain. Modules can either use
121 * ereport_domain() directly, or preferably they can override the TEXTDOMAIN
122 * macro.
123 *
124 * When pg_integer_constant_p is available and elevel >= ERROR we make
125 * a call to errstart_cold() instead of errstart(). This version of the
126 * function is marked with pg_attribute_cold which will coax supporting
127 * compilers into generating code which is more optimized towards non-ERROR
128 * cases. Because we use pg_integer_constant_p() in the condition,
129 * when elevel is not a compile-time constant, or if it is, but it's < ERROR,
130 * the compiler has no need to generate any code for this branch. It can
131 * simply call errstart() unconditionally.
132 *
133 * If elevel >= ERROR, the call will not return; we try to inform the compiler
134 * of that via pg_unreachable(). However, no useful optimization effect is
135 * obtained unless the compiler sees elevel as a compile-time constant, else
136 * we're just adding code bloat. So, if pg_integer_constant_p is
137 * available, use that to cause the second if() to vanish completely for
138 * non-constant cases. We avoid using a local variable because it's not
139 * necessary and prevents gcc from making the unreachability deduction at
140 * optlevel -O0.
141 *----------
142 */
143#ifdef HAVE_PG_INTEGER_CONSTANT_P
144#define ereport_domain(elevel, domain, ...) \
145 do { \
146 pg_prevent_errno_in_scope(); \
147 if (pg_integer_constant_p(elevel) && (elevel) >= ERROR ? \
148 errstart_cold(elevel, domain) : \
149 errstart(elevel, domain)) \
150 __VA_ARGS__, errfinish(__FILE__, __LINE__, __func__); \
151 if (pg_integer_constant_p(elevel) && (elevel) >= ERROR) \
152 pg_unreachable(); \
153 } while(0)
154#else /* !HAVE_PG_INTEGER_CONSTANT_P */
155#define ereport_domain(elevel, domain, ...) \
156 do { \
157 const int elevel_ = (elevel); \
158 pg_prevent_errno_in_scope(); \
159 if (errstart(elevel_, domain)) \
160 __VA_ARGS__, errfinish(__FILE__, __LINE__, __func__); \
161 if (elevel_ >= ERROR) \
162 pg_unreachable(); \
163 } while(0)
164#endif /* HAVE_PG_INTEGER_CONSTANT_P */
165
166#define ereport(elevel, ...) \
167 ereport_domain(elevel, TEXTDOMAIN, __VA_ARGS__)
169#define TEXTDOMAIN NULL
170
171extern bool message_level_is_interesting(int elevel);
173extern bool errstart(int elevel, const char *domain);
174extern pg_attribute_cold bool errstart_cold(int elevel, const char *domain);
175extern void errfinish(const char *filename, int lineno, const char *funcname);
176
177extern int errcode(int sqlerrcode);
178
179extern int errcode_for_file_access(void);
180extern int errcode_for_socket_access(void);
181
182extern int errmsg(const char *fmt,...) pg_attribute_printf(1, 2);
184
186 unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
188extern int errdetail(const char *fmt,...) pg_attribute_printf(1, 2);
190
192
194 const char *fmt_plural,
195 unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
196
198 unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
199
204 unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
205
207 * errcontext() is typically called in error context callback functions, not
208 * within an ereport() invocation. The callback function can be in a different
209 * module than the ereport() call, so the message domain passed in errstart()
210 * is not usually the correct domain for translating the context message.
211 * set_errcontext_domain() first sets the domain to be used, and
212 * errcontext_msg() passes the actual message.
213 */
214#define errcontext set_errcontext_domain(TEXTDOMAIN), errcontext_msg
215
216extern int set_errcontext_domain(const char *domain);
217
218extern int errcontext_msg(const char *fmt,...) pg_attribute_printf(1, 2);
220extern int errhidestmt(bool hide_stmt);
221extern int errhidecontext(bool hide_ctx);
222
223extern int errbacktrace(void);
224
225extern int errposition(int cursorpos);
226
227extern int internalerrposition(int cursorpos);
229
230extern int err_generic_string(int field, const char *str);
231
232extern int geterrcode(void);
233extern int geterrposition(void);
235
236
237/*----------
238 * Old-style error reporting API: to be used in this way:
239 * elog(ERROR, "portal \"%s\" not found", stmt->portalname);
240 *----------
241 */
242#define elog(elevel, ...) \
243 ereport(elevel, errmsg_internal(__VA_ARGS__))
244
245
246/*----------
247 * Support for reporting "soft" errors that don't require a full transaction
248 * abort to clean up. This is to be used in this way:
249 * errsave(context,
250 * errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
251 * errmsg("invalid input syntax for type %s: \"%s\"",
252 * "boolean", in_str),
253 * ... other errxxx() fields as needed ...);
254 *
255 * "context" is a node pointer or NULL, and the remaining auxiliary calls
256 * provide the same error details as in ereport(). If context is not a
257 * pointer to an ErrorSaveContext node, then errsave(context, ...)
258 * behaves identically to ereport(ERROR, ...). If context is a pointer
259 * to an ErrorSaveContext node, then the information provided by the
260 * auxiliary calls is stored in the context node and control returns
261 * normally. The caller of errsave() must then do any required cleanup
262 * and return control back to its caller. That caller must check the
263 * ErrorSaveContext node to see whether an error occurred before
264 * it can trust the function's result to be meaningful.
265 *
266 * errsave_domain() allows a message domain to be specified; it is
267 * precisely analogous to ereport_domain().
268 *----------
269 */
270#define errsave_domain(context, domain, ...) \
271 do { \
272 struct Node *context_ = (context); \
273 pg_prevent_errno_in_scope(); \
274 if (errsave_start(context_, domain)) \
275 __VA_ARGS__, errsave_finish(context_, __FILE__, __LINE__, __func__); \
276 } while(0)
277
278#define errsave(context, ...) \
279 errsave_domain(context, TEXTDOMAIN, __VA_ARGS__)
281/*
282 * "ereturn(context, dummy_value, ...);" is exactly the same as
283 * "errsave(context, ...); return dummy_value;". This saves a bit
284 * of typing in the common case where a function has no cleanup
285 * actions to take after reporting a soft error. "dummy_value"
286 * can be empty if the function returns void.
287 */
288#define ereturn_domain(context, dummy_value, domain, ...) \
289 do { \
290 errsave_domain(context, domain, __VA_ARGS__); \
291 return dummy_value; \
292 } while(0)
293
294#define ereturn(context, dummy_value, ...) \
295 ereturn_domain(context, dummy_value, TEXTDOMAIN, __VA_ARGS__)
296
297extern bool errsave_start(struct Node *context, const char *domain);
298extern void errsave_finish(struct Node *context,
299 const char *filename, int lineno,
300 const char *funcname);
303/* Support for constructing error strings separately from ereport() calls */
304
305extern void pre_format_elog_string(int errnumber, const char *domain);
306extern char *format_elog_string(const char *fmt,...) pg_attribute_printf(1, 2);
307
308
309/* Support for attaching context information to error reports */
310
312{
314 void (*callback) (void *arg);
315 void *arg;
317
319
320
321/*----------
322 * API for catching ereport(ERROR) exits. Use these macros like so:
323 *
324 * PG_TRY();
325 * {
326 * ... code that might throw ereport(ERROR) ...
327 * }
328 * PG_CATCH();
329 * {
330 * ... error recovery code ...
331 * }
332 * PG_END_TRY();
333 *
334 * (The braces are not actually necessary, but are recommended so that
335 * pgindent will indent the construct nicely.) The error recovery code
336 * can either do PG_RE_THROW to propagate the error outwards, or do a
337 * (sub)transaction abort. Failure to do so may leave the system in an
338 * inconsistent state for further processing.
339 *
340 * For the common case that the error recovery code and the cleanup in the
341 * normal code path are identical, the following can be used instead:
342 *
343 * PG_TRY();
344 * {
345 * ... code that might throw ereport(ERROR) ...
346 * }
347 * PG_FINALLY();
348 * {
349 * ... cleanup code ...
350 * }
351 * PG_END_TRY();
352 *
353 * The cleanup code will be run in either case, and any error will be rethrown
354 * afterwards.
355 *
356 * You cannot use both PG_CATCH() and PG_FINALLY() in the same
357 * PG_TRY()/PG_END_TRY() block.
358 *
359 * Note: while the system will correctly propagate any new ereport(ERROR)
360 * occurring in the recovery section, there is a small limit on the number
361 * of levels this will work for. It's best to keep the error recovery
362 * section simple enough that it can't generate any new errors, at least
363 * not before popping the error stack.
364 *
365 * Note: an ereport(FATAL) will not be caught by this construct; control will
366 * exit straight through proc_exit(). Therefore, do NOT put any cleanup
367 * of non-process-local resources into the error recovery section, at least
368 * not without taking thought for what will happen during ereport(FATAL).
369 * The PG_ENSURE_ERROR_CLEANUP macros provided by storage/ipc.h may be
370 * helpful in such cases.
371 *
372 * Note: if a local variable of the function containing PG_TRY is modified
373 * in the PG_TRY section and used in the PG_CATCH section, that variable
374 * must be declared "volatile" for POSIX compliance. This is not mere
375 * pedantry; we have seen bugs from compilers improperly optimizing code
376 * away when such a variable was not marked. Beware that gcc's -Wclobbered
377 * warnings are just about entirely useless for catching such oversights.
378 *
379 * Each of these macros accepts an optional argument which can be specified
380 * to apply a suffix to the variables declared within the macros. This suffix
381 * can be used to avoid the compiler emitting warnings about shadowed
382 * variables when compiling with -Wshadow in situations where nested PG_TRY()
383 * statements are required. The optional suffix may contain any character
384 * that's allowed in a variable name. The suffix, if specified, must be the
385 * same within each component macro of the given PG_TRY() statement.
386 *----------
387 */
388#define PG_TRY(...) \
389 do { \
390 sigjmp_buf *_save_exception_stack##__VA_ARGS__ = PG_exception_stack; \
391 ErrorContextCallback *_save_context_stack##__VA_ARGS__ = error_context_stack; \
392 sigjmp_buf _local_sigjmp_buf##__VA_ARGS__; \
393 bool _do_rethrow##__VA_ARGS__ = false; \
394 if (sigsetjmp(_local_sigjmp_buf##__VA_ARGS__, 0) == 0) \
395 { \
396 PG_exception_stack = &_local_sigjmp_buf##__VA_ARGS__
397
398#define PG_CATCH(...) \
399 } \
400 else \
401 { \
402 PG_exception_stack = _save_exception_stack##__VA_ARGS__; \
403 error_context_stack = _save_context_stack##__VA_ARGS__
404
405#define PG_FINALLY(...) \
406 } \
407 else \
408 _do_rethrow##__VA_ARGS__ = true; \
409 { \
410 PG_exception_stack = _save_exception_stack##__VA_ARGS__; \
411 error_context_stack = _save_context_stack##__VA_ARGS__
412
413#define PG_END_TRY(...) \
414 } \
415 if (_do_rethrow##__VA_ARGS__) \
416 PG_RE_THROW(); \
417 PG_exception_stack = _save_exception_stack##__VA_ARGS__; \
418 error_context_stack = _save_context_stack##__VA_ARGS__; \
419 } while (0)
420
421#define PG_RE_THROW() \
422 pg_re_throw()
427/* Stuff that error handlers might want to use */
430 * ErrorData holds the data accumulated during any one ereport() cycle.
431 * Any non-NULL pointers must point to palloc'd data.
432 * (The const pointers are an exception; we assume they point at non-freeable
433 * constant strings.)
434 */
435typedef struct ErrorData
437 int elevel; /* error level */
438 bool output_to_server; /* will report to server log? */
439 bool output_to_client; /* will report to client? */
440 bool hide_stmt; /* true to prevent STATEMENT: inclusion */
441 bool hide_ctx; /* true to prevent CONTEXT: inclusion */
442 const char *filename; /* __FILE__ of ereport() call */
443 int lineno; /* __LINE__ of ereport() call */
444 const char *funcname; /* __func__ of ereport() call */
445 const char *domain; /* message domain */
446 const char *context_domain; /* message domain for context message */
447 int sqlerrcode; /* encoded ERRSTATE */
448 char *message; /* primary error message (translated) */
449 char *detail; /* detail error message */
450 char *detail_log; /* detail error message for server log only */
451 char *hint; /* hint message */
452 char *context; /* context message */
453 char *backtrace; /* backtrace */
454 const char *message_id; /* primary message's id (original string) */
455 char *schema_name; /* name of schema */
456 char *table_name; /* name of table */
457 char *column_name; /* name of column */
458 char *datatype_name; /* name of datatype */
459 char *constraint_name; /* name of constraint */
460 int cursorpos; /* cursor index into query string */
461 int internalpos; /* cursor index into internalquery */
462 char *internalquery; /* text of internally-generated query */
463 int saved_errno; /* errno at entry */
464
465 /* context containing associated non-constant strings */
467} ErrorData;
468
469extern void EmitErrorReport(void);
470extern ErrorData *CopyErrorData(void);
471extern void FreeErrorData(ErrorData *edata);
472extern void FlushErrorState(void);
475pg_noreturn extern void pg_re_throw(void);
477extern char *GetErrorContextStack(void);
478
479/* Hook for intercepting messages before they are sent to the server log */
482
483
484/* GUC-configurable parameters */
485
486typedef enum
488 PGERROR_TERSE, /* single-line error messages */
489 PGERROR_DEFAULT, /* recommended style */
490 PGERROR_VERBOSE, /* all the facts, ma'am */
492
494extern PGDLLIMPORT char *Log_line_prefix;
499
500/* Log destination bitmap */
501#define LOG_DESTINATION_STDERR 1
502#define LOG_DESTINATION_SYSLOG 2
503#define LOG_DESTINATION_EVENTLOG 4
504#define LOG_DESTINATION_CSVLOG 8
505#define LOG_DESTINATION_JSONLOG 16
506
507/* Other exported functions */
508extern void log_status_format(StringInfo buf, const char *format,
510extern void DebugFileOpen(void);
511extern char *unpack_sql_state(int sql_state);
512extern bool in_error_recursion_trouble(void);
513
514/* Common functions shared across destinations */
515extern void reset_formatted_start_time(void);
516extern char *get_formatted_start_time(void);
517extern char *get_formatted_log_time(void);
518extern const char *get_backend_type_for_log(void);
520extern const char *error_severity(int elevel);
521extern void write_pipe_chunks(char *data, int len, int dest);
522
523/* Destination-specific functions */
524extern void write_csvlog(ErrorData *edata);
525extern void write_jsonlog(ErrorData *edata);
526
527/*
528 * Write errors to stderr (or by equal means when stderr is
529 * not available). Used before ereport/elog can be used
530 * safely (memory context, GUC load etc)
531 */
532extern void write_stderr(const char *fmt,...) pg_attribute_printf(1, 2);
534
535#endif /* ELOG_H */
#define write_stderr(str)
Definition parallel.c:186
#define PGDLLIMPORT
Definition c.h:1421
#define pg_attribute_cold
Definition c.h:346
#define pg_noreturn
Definition c.h:190
#define pg_attribute_printf(f, a)
Definition c.h:268
Datum arg
Definition elog.c:1323
PGErrorVerbosity
Definition elog.h:473
@ PGERROR_VERBOSE
Definition elog.h:476
@ PGERROR_DEFAULT
Definition elog.h:475
@ PGERROR_TERSE
Definition elog.h:474
int getinternalerrposition(void)
int int errhidestmt(bool hide_stmt)
PGDLLIMPORT int Log_error_verbosity
Definition elog.c:114
PGDLLIMPORT int Log_destination
Definition elog.c:116
void(* emit_log_hook_type)(ErrorData *edata)
Definition elog.h:466
int errcode_for_socket_access(void)
Definition elog.c:977
bool errsave_start(struct Node *context, const char *domain)
Definition elog.c:651
int err_generic_string(int field, const char *str)
PGDLLIMPORT sigjmp_buf * PG_exception_stack
Definition elog.c:102
int int errdetail_internal(const char *fmt,...) pg_attribute_printf(1
void errsave_finish(struct Node *context, const char *filename, int lineno, const char *funcname)
Definition elog.c:703
int errhint(const char *fmt,...) pg_attribute_printf(1
int internalerrquery(const char *query)
int int int errhint_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1
int internalerrposition(int cursorpos)
bool check_log_of_query(ErrorData *edata)
Definition elog.c:3180
int geterrcode(void)
bool errstart(int elevel, const char *domain)
Definition elog.c:355
void EmitErrorReport(void)
Definition elog.c:1883
int errdetail(const char *fmt,...) pg_attribute_printf(1
char * GetErrorContextStack(void)
Definition elog.c:2255
void DebugFileOpen(void)
Definition elog.c:2307
void FreeErrorData(ErrorData *edata)
Definition elog.c:2014
const char * error_severity(int elevel)
Definition elog.c:4157
int int errmsg_internal(const char *fmt,...) pg_attribute_printf(1
int errcode_for_file_access(void)
Definition elog.c:898
pg_noreturn void ReThrowError(ErrorData *edata)
Definition elog.c:2150
void pre_format_elog_string(int errnumber, const char *domain)
Definition elog.c:1841
int int int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1
int errbacktrace(void)
Definition elog.c:1116
char * get_formatted_start_time(void)
Definition elog.c:3156
ErrorData * CopyErrorData(void)
Definition elog.c:1942
PGDLLIMPORT char * Log_destination_string
Definition elog.c:117
void FlushErrorState(void)
Definition elog.c:2063
PGDLLIMPORT emit_log_hook_type emit_log_hook
Definition elog.c:111
int errcontext_msg(const char *fmt,...) pg_attribute_printf(1
void ThrowErrorData(ErrorData *edata)
Definition elog.c:2091
bool message_level_is_interesting(int elevel)
Definition elog.c:285
void write_pipe_chunks(char *data, int len, int dest)
Definition elog.c:3916
int errhidecontext(bool hide_ctx)
int int int errdetail_log(const char *fmt,...) pg_attribute_printf(1
int geterrposition(void)
PGDLLIMPORT char * Log_line_prefix
Definition elog.c:115
void write_csvlog(ErrorData *edata)
Definition csvlog.c:63
void void vwrite_stderr(const char *fmt, va_list ap) pg_attribute_printf(1
pg_attribute_cold bool errstart_cold(int elevel, const char *domain)
Definition elog.c:339
void write_jsonlog(ErrorData *edata)
Definition jsonlog.c:109
const char * get_backend_type_for_log(void)
Definition elog.c:3203
int errcode(int sqlerrcode)
Definition elog.c:875
pg_noreturn void pg_re_throw(void)
Definition elog.c:2200
PGDLLIMPORT bool syslog_split_messages
Definition elog.c:119
PGDLLIMPORT ErrorContextCallback * error_context_stack
Definition elog.c:100
PGDLLIMPORT bool syslog_sequence_numbers
Definition elog.c:118
char * format_elog_string(const char *fmt,...) pg_attribute_printf(1
void log_status_format(StringInfo buf, const char *format, ErrorData *edata)
Definition elog.c:3270
char * get_formatted_log_time(void)
Definition elog.c:3106
bool in_error_recursion_trouble(void)
Definition elog.c:306
void errfinish(const char *filename, int lineno, const char *funcname)
Definition elog.c:486
int errposition(int cursorpos)
char * unpack_sql_state(int sql_state)
Definition elog.c:3655
int int int int errdetail_log_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1
int set_errcontext_domain(const char *domain)
void reset_formatted_start_time(void)
Definition elog.c:3144
int errdetail_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1
int int errhint_internal(const char *fmt,...) pg_attribute_printf(1
const char * str
#define funcname
static char * errmsg
static char format
const void size_t len
const void * data
static char * filename
Definition pg_dumpall.c:133
static char buf[DEFAULT_XLOG_SEG_SIZE]
static int fb(int x)
struct ErrorContextCallback * previous
Definition elog.h:299
int internalpos
Definition elog.h:447
char * schema_name
Definition elog.h:441
char * context
Definition elog.h:438
const char * domain
Definition elog.h:431
char * internalquery
Definition elog.h:448
int saved_errno
Definition elog.h:449
int sqlerrcode
Definition elog.h:433
struct MemoryContextData * assoc_context
Definition elog.h:452
const char * filename
Definition elog.h:428
bool output_to_server
Definition elog.h:424
int elevel
Definition elog.h:423
char * datatype_name
Definition elog.h:444
char * detail
Definition elog.h:435
const char * context_domain
Definition elog.h:432
const char * funcname
Definition elog.h:430
char * table_name
Definition elog.h:442
char * backtrace
Definition elog.h:439
char * message
Definition elog.h:434
bool hide_stmt
Definition elog.h:426
char * detail_log
Definition elog.h:436
int lineno
Definition elog.h:429
const char * message_id
Definition elog.h:440
char * hint
Definition elog.h:437
bool hide_ctx
Definition elog.h:427
char * constraint_name
Definition elog.h:445
int cursorpos
Definition elog.h:446
bool output_to_client
Definition elog.h:425
char * column_name
Definition elog.h:443
Definition nodes.h:135
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)