PostgreSQL Source Code git master
Loading...
Searching...
No Matches
elog.c File Reference
#include "postgres.h"
#include <fcntl.h>
#include <time.h>
#include <unistd.h>
#include <signal.h>
#include <ctype.h>
#include "access/xact.h"
#include "common/ip.h"
#include "libpq/libpq.h"
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "nodes/miscnodes.h"
#include "pgstat.h"
#include "postmaster/bgworker.h"
#include "postmaster/postmaster.h"
#include "postmaster/syslogger.h"
#include "storage/ipc.h"
#include "storage/proc.h"
#include "tcop/tcopprot.h"
#include "utils/guc_hooks.h"
#include "utils/memutils.h"
#include "utils/pg_locale.h"
#include "utils/ps_status.h"
#include "utils/varlena.h"
#include "postmaster/proctypelist.h"
Include dependency graph for elog.c:

Go to the source code of this file.

Macros

#define _(x)   err_gettext(x)
 
#define ERRORDATA_STACK_SIZE   5
 
#define FORMATTED_TS_LEN   128
 
#define CHECK_STACK_DEPTH()
 
#define EVALUATE_MESSAGE(domain, targetfield, appendval, translateit)
 
#define EVALUATE_MESSAGE_PLURAL(domain, targetfield, appendval)
 
#define PG_PROCTYPE(bktype, bkcategory, description, main_func, shmem_attach)    [bktype] = bkcategory,
 

Functions

static const charerr_gettext (const char *str) pg_attribute_format_arg(1)
 
static ErrorDataget_error_stack_entry (void)
 
static void set_stack_entry_domain (ErrorData *edata, const char *domain)
 
static void set_stack_entry_location (ErrorData *edata, const char *filename, int lineno, const char *funcname)
 
static bool matches_backtrace_functions (const char *funcname)
 
static pg_noinline void set_backtrace (ErrorData *edata, int num_skip)
 
static void backtrace_cleanup (int code, Datum arg)
 
static void set_errdata_field (MemoryContextData *cxt, char **ptr, const char *str)
 
static void FreeErrorDataContents (ErrorData *edata)
 
static int log_min_messages_cmp (const ListCell *a, const ListCell *b)
 
static void write_console (const char *line, int len)
 
static const charprocess_log_prefix_padding (const char *p, int *ppadding)
 
static void log_line_prefix (StringInfo buf, ErrorData *edata)
 
static void send_message_to_server_log (ErrorData *edata)
 
static void send_message_to_frontend (ErrorData *edata)
 
static void append_with_tabs (StringInfo buf, const char *str)
 
static bool is_log_level_output (int elevel, int log_min_level)
 
static bool should_output_to_server (int elevel)
 
static bool should_output_to_client (int elevel)
 
bool message_level_is_interesting (int elevel)
 
bool in_error_recursion_trouble (void)
 
pg_attribute_cold bool errstart_cold (int elevel, const char *domain)
 
bool errstart (int elevel, const char *domain)
 
void errfinish (const char *filename, int lineno, const char *funcname)
 
bool errsave_start (struct Node *context, const char *domain)
 
void errsave_finish (struct Node *context, const char *filename, int lineno, const char *funcname)
 
int errcode (int sqlerrcode)
 
int errcode_for_file_access (void)
 
int errcode_for_socket_access (void)
 
int errmsg (const char *fmt,...)
 
int errbacktrace (void)
 
 pg_attribute_unused () static void backtrace_cleanup(int code
 
void pre_format_elog_string (int errnumber, const char *domain)
 
charformat_elog_string (const char *fmt,...)
 
void EmitErrorReport (void)
 
ErrorDataCopyErrorData (void)
 
void FreeErrorData (ErrorData *edata)
 
void FlushErrorState (void)
 
void ThrowErrorData (ErrorData *edata)
 
void ReThrowError (ErrorData *edata)
 
void pg_re_throw (void)
 
charGetErrorContextStack (void)
 
void DebugFileOpen (void)
 
bool check_log_min_messages (char **newval, void **extra, GucSource source)
 
void assign_log_min_messages (const char *newval, void *extra)
 
bool check_backtrace_functions (char **newval, void **extra, GucSource source)
 
void assign_backtrace_functions (const char *newval, void *extra)
 
bool check_log_destination (char **newval, void **extra, GucSource source)
 
void assign_log_destination (const char *newval, void *extra)
 
void assign_syslog_ident (const char *newval, void *extra)
 
void assign_syslog_facility (int newval, void *extra)
 
charget_formatted_log_time (void)
 
void reset_formatted_start_time (void)
 
charget_formatted_start_time (void)
 
bool check_log_of_query (ErrorData *edata)
 
const charget_backend_type_for_log (void)
 
void log_status_format (StringInfo buf, const char *format, ErrorData *edata)
 
charunpack_sql_state (int sql_state)
 
void write_pipe_chunks (char *data, int len, int dest)
 
static void err_sendstring (StringInfo buf, const char *str)
 
const charerror_severity (int elevel)
 
void write_stderr (const char *fmt,...)
 
void vwrite_stderr (const char *fmt, va_list ap)
 

Variables

ErrorContextCallbackerror_context_stack = NULL
 
sigjmp_bufPG_exception_stack = NULL
 
emit_log_hook_type emit_log_hook = NULL
 
int Log_error_verbosity = PGERROR_DEFAULT
 
charLog_line_prefix = NULL
 
int Log_destination = LOG_DESTINATION_STDERR
 
charLog_destination_string = NULL
 
bool syslog_sequence_numbers = true
 
bool syslog_split_messages = true
 
static charbacktrace_function_list
 
static ErrorData errordata [ERRORDATA_STACK_SIZE]
 
static int errordata_stack_depth = -1
 
static int recursion_depth = 0
 
static struct timeval saved_timeval
 
static bool saved_timeval_set = false
 
static char formatted_start_time [FORMATTED_TS_LEN]
 
static char formatted_log_time [FORMATTED_TS_LEN]
 
Datum arg
 
static const charsave_format_domain
 

Macro Definition Documentation

◆ _

#define _ (   x)    err_gettext(x)

Definition at line 96 of file elog.c.

◆ CHECK_STACK_DEPTH

#define CHECK_STACK_DEPTH ( )
Value:
do { \
{ \
ereport(ERROR, (errmsg_internal("errstart was not called"))); \
} \
} while (0)
static int errordata_stack_depth
Definition elog.c:158
int int errmsg_internal(const char *fmt,...) pg_attribute_printf(1
#define ERROR
Definition elog.h:40
static int fb(int x)

Definition at line 175 of file elog.c.

176 { \
178 { \
180 ereport(ERROR, (errmsg_internal("errstart was not called"))); \
181 } \
182 } while (0)

◆ ERRORDATA_STACK_SIZE

#define ERRORDATA_STACK_SIZE   5

Definition at line 154 of file elog.c.

◆ EVALUATE_MESSAGE

#define EVALUATE_MESSAGE (   domain,
  targetfield,
  appendval,
  translateit 
)
Value:
{ \
/* Internationalize the error format string */ \
fmt = dgettext((domain), fmt); \
if ((appendval) && edata->targetfield) { \
} \
/* Generate actual output --- have to use appendStringInfoVA */ \
for (;;) \
{ \
va_list args; \
int needed; \
errno = edata->saved_errno; \
va_start(args, fmt); \
va_end(args); \
if (needed == 0) \
break; \
} \
/* Save the completed message into the stack item */ \
if (edata->targetfield) \
pfree(edata->targetfield); \
edata->targetfield = pstrdup(buf.data); \
pfree(buf.data); \
}
#define dgettext(d, x)
Definition c.h:1269
bool in_error_recursion_trouble(void)
Definition elog.c:306
char * pstrdup(const char *in)
Definition mcxt.c:1781
static char buf[DEFAULT_XLOG_SEG_SIZE]
int appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
Definition stringinfo.c:187

Definition at line 1013 of file elog.c.

1014 { \
1016 /* Internationalize the error format string */ \
1018 fmt = dgettext((domain), fmt); \
1020 if ((appendval) && edata->targetfield) { \
1021 appendStringInfoString(&buf, edata->targetfield); \
1022 appendStringInfoChar(&buf, '\n'); \
1023 } \
1024 /* Generate actual output --- have to use appendStringInfoVA */ \
1025 for (;;) \
1026 { \
1027 va_list args; \
1028 int needed; \
1029 errno = edata->saved_errno; \
1030 va_start(args, fmt); \
1031 needed = appendStringInfoVA(&buf, fmt, args); \
1032 va_end(args); \
1033 if (needed == 0) \
1034 break; \
1036 } \
1037 /* Save the completed message into the stack item */ \
1038 if (edata->targetfield) \
1039 pfree(edata->targetfield); \
1040 edata->targetfield = pstrdup(buf.data); \
1041 pfree(buf.data); \
1042 }

◆ EVALUATE_MESSAGE_PLURAL

#define EVALUATE_MESSAGE_PLURAL (   domain,
  targetfield,
  appendval 
)

Definition at line 1049 of file elog.c.

1050 { \
1051 const char *fmt; \
1053 /* Internationalize the error format string */ \
1055 fmt = dngettext((domain), fmt_singular, fmt_plural, n); \
1056 else \
1057 fmt = (n == 1 ? fmt_singular : fmt_plural); \
1059 if ((appendval) && edata->targetfield) { \
1060 appendStringInfoString(&buf, edata->targetfield); \
1061 appendStringInfoChar(&buf, '\n'); \
1062 } \
1063 /* Generate actual output --- have to use appendStringInfoVA */ \
1064 for (;;) \
1065 { \
1066 va_list args; \
1067 int needed; \
1068 errno = edata->saved_errno; \
1069 va_start(args, n); \
1070 needed = appendStringInfoVA(&buf, fmt, args); \
1071 va_end(args); \
1072 if (needed == 0) \
1073 break; \
1075 } \
1076 /* Save the completed message into the stack item */ \
1077 if (edata->targetfield) \
1078 pfree(edata->targetfield); \
1079 edata->targetfield = pstrdup(buf.data); \
1080 pfree(buf.data); \
1081 }
#define dngettext(d, s, p, n)
Definition c.h:1271

◆ FORMATTED_TS_LEN

#define FORMATTED_TS_LEN   128

Definition at line 169 of file elog.c.

◆ PG_PROCTYPE

#define PG_PROCTYPE (   bktype,
  bkcategory,
  description,
  main_func,
  shmem_attach 
)     [bktype] = bkcategory,

Function Documentation

◆ append_with_tabs()

static void append_with_tabs ( StringInfo  buf,
const char str 
)
static

Definition at line 4210 of file elog.c.

4211{
4212 char ch;
4213
4214 while ((ch = *str++) != '\0')
4215 {
4217 if (ch == '\n')
4219 }
4220}
const char * str
#define appendStringInfoCharMacro(str, ch)
Definition stringinfo.h:231

References appendStringInfoCharMacro, buf, fb(), and str.

Referenced by send_message_to_server_log().

◆ assign_backtrace_functions()

void assign_backtrace_functions ( const char newval,
void extra 
)

Definition at line 2669 of file elog.c.

2670{
2671 backtrace_function_list = (char *) extra;
2672}
static char * backtrace_function_list
Definition elog.c:122

References backtrace_function_list.

◆ assign_log_destination()

void assign_log_destination ( const char newval,
void extra 
)

Definition at line 2742 of file elog.c.

2743{
2744 Log_destination = *((int *) extra);
2745}
int Log_destination
Definition elog.c:116

References Log_destination.

◆ assign_log_min_messages()

void assign_log_min_messages ( const char newval,
void extra 
)

Definition at line 2591 of file elog.c.

2592{
2593 for (int i = 0; i < BACKEND_NUM_TYPES; i++)
2594 log_min_messages[i] = ((int *) extra)[i];
2595}
int log_min_messages[]
Definition guc_tables.c:681
int i
Definition isn.c:77
#define BACKEND_NUM_TYPES
Definition miscadmin.h:392

References BACKEND_NUM_TYPES, i, and log_min_messages.

◆ assign_syslog_facility()

void assign_syslog_facility ( int  newval,
void extra 
)

Definition at line 2783 of file elog.c.

2784{
2785#ifdef HAVE_SYSLOG
2786 /*
2787 * As above, don't thrash the syslog connection unnecessarily.
2788 */
2789 if (syslog_facility != newval)
2790 {
2791 if (openlog_done)
2792 {
2793 closelog();
2794 openlog_done = false;
2795 }
2797 }
2798#endif
2799 /* Without syslog support, just ignore it */
2800}
#define newval
static int syslog_facility
Definition guc_tables.c:633

References fb(), newval, and syslog_facility.

◆ assign_syslog_ident()

void assign_syslog_ident ( const char newval,
void extra 
)

Definition at line 2751 of file elog.c.

2752{
2753#ifdef HAVE_SYSLOG
2754 /*
2755 * guc.c is likely to call us repeatedly with same parameters, so don't
2756 * thrash the syslog connection unnecessarily. Also, we do not re-open
2757 * the connection until needed, since this routine will get called whether
2758 * or not Log_destination actually mentions syslog.
2759 *
2760 * Note that we make our own copy of the ident string rather than relying
2761 * on guc.c's. This may be overly paranoid, but it ensures that we cannot
2762 * accidentally free a string that syslog is still using.
2763 */
2764 if (syslog_ident == NULL || strcmp(syslog_ident, newval) != 0)
2765 {
2766 if (openlog_done)
2767 {
2768 closelog();
2769 openlog_done = false;
2770 }
2773 /* if the strdup fails, we will cope in write_syslog() */
2774 }
2775#endif
2776 /* Without syslog support, just ignore it */
2777}
#define free(a)

References fb(), free, and newval.

◆ backtrace_cleanup()

static void backtrace_cleanup ( int  code,
Datum  arg 
)
static

Referenced by set_backtrace().

◆ check_backtrace_functions()

bool check_backtrace_functions ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 2608 of file elog.c.

2609{
2610 int newvallen = strlen(*newval);
2611 char *someval;
2612 int validlen;
2613 int i;
2614 int j;
2615
2616 /*
2617 * Allow characters that can be C identifiers and commas as separators, as
2618 * well as some whitespace for readability.
2619 */
2621 "0123456789_"
2622 "abcdefghijklmnopqrstuvwxyz"
2623 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
2624 ", \n\t");
2625 if (validlen != newvallen)
2626 {
2627 GUC_check_errdetail("Invalid character.");
2628 return false;
2629 }
2630
2631 if ((*newval)[0] == '\0')
2632 {
2633 *extra = NULL;
2634 return true;
2635 }
2636
2637 /*
2638 * Allocate space for the output and create the copy. We could discount
2639 * whitespace chars to save some memory, but it doesn't seem worth the
2640 * trouble.
2641 */
2642 someval = guc_malloc(LOG, newvallen + 1 + 1);
2643 if (!someval)
2644 return false;
2645 for (i = 0, j = 0; i < newvallen; i++)
2646 {
2647 if ((*newval)[i] == ',')
2648 someval[j++] = '\0'; /* next item */
2649 else if ((*newval)[i] == ' ' ||
2650 (*newval)[i] == '\n' ||
2651 (*newval)[i] == '\t')
2652 ; /* ignore these */
2653 else
2654 someval[j++] = (*newval)[i]; /* copy anything else */
2655 }
2656
2657 /* two \0s end the setting */
2658 someval[j] = '\0';
2659 someval[j + 1] = '\0';
2660
2661 *extra = someval;
2662 return true;
2663}
#define LOG
Definition elog.h:32
void * guc_malloc(int elevel, size_t size)
Definition guc.c:637
#define GUC_check_errdetail
Definition guc.h:507
int j
Definition isn.c:78

References fb(), GUC_check_errdetail, guc_malloc(), i, j, LOG, and newval.

◆ check_log_destination()

bool check_log_destination ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 2678 of file elog.c.

2679{
2680 char *rawstring;
2681 List *elemlist;
2682 ListCell *l;
2683 int newlogdest = 0;
2684 int *myextra;
2685
2686 /* Need a modifiable copy of string */
2688
2689 /* Parse string into list of identifiers */
2691 {
2692 /* syntax error in list */
2693 GUC_check_errdetail("List syntax is invalid.");
2696 return false;
2697 }
2698
2699 foreach(l, elemlist)
2700 {
2701 char *tok = (char *) lfirst(l);
2702
2703 if (pg_strcasecmp(tok, "stderr") == 0)
2705 else if (pg_strcasecmp(tok, "csvlog") == 0)
2707 else if (pg_strcasecmp(tok, "jsonlog") == 0)
2709#ifdef HAVE_SYSLOG
2710 else if (pg_strcasecmp(tok, "syslog") == 0)
2712#endif
2713#ifdef WIN32
2714 else if (pg_strcasecmp(tok, "eventlog") == 0)
2716#endif
2717 else
2718 {
2719 GUC_check_errdetail("Unrecognized key word: \"%s\".", tok);
2722 return false;
2723 }
2724 }
2725
2728
2729 myextra = (int *) guc_malloc(LOG, sizeof(int));
2730 if (!myextra)
2731 return false;
2733 *extra = myextra;
2734
2735 return true;
2736}
#define LOG_DESTINATION_JSONLOG
Definition elog.h:491
#define LOG_DESTINATION_SYSLOG
Definition elog.h:488
#define LOG_DESTINATION_STDERR
Definition elog.h:487
#define LOG_DESTINATION_EVENTLOG
Definition elog.h:489
#define LOG_DESTINATION_CSVLOG
Definition elog.h:490
void list_free(List *list)
Definition list.c:1546
void pfree(void *pointer)
Definition mcxt.c:1616
#define lfirst(lc)
Definition pg_list.h:172
int pg_strcasecmp(const char *s1, const char *s2)
Definition pg_list.h:54
bool SplitIdentifierString(char *rawstring, char separator, List **namelist)
Definition varlena.c:2867

References fb(), GUC_check_errdetail, guc_malloc(), lfirst, list_free(), LOG, LOG_DESTINATION_CSVLOG, LOG_DESTINATION_EVENTLOG, LOG_DESTINATION_JSONLOG, LOG_DESTINATION_STDERR, LOG_DESTINATION_SYSLOG, newval, pfree(), pg_strcasecmp(), pstrdup(), and SplitIdentifierString().

◆ check_log_min_messages()

bool check_log_min_messages ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 2363 of file elog.c.

2364{
2365 char *rawstring;
2366 List *elemlist;
2368 char *result;
2370 bool assigned[BACKEND_NUM_TYPES] = {0};
2371 int defaultlevel = -1; /* -1 means not assigned */
2372
2373 const char *const process_types[] = {
2374#define PG_PROCTYPE(bktype, bkcategory, description, main_func, shmem_attach) \
2375 [bktype] = bkcategory,
2377#undef PG_PROCTYPE
2378 };
2379
2380 /* Need a modifiable copy of string. */
2382 if (rawstring == NULL)
2383 return false;
2384
2385 /* Parse the string into a list. */
2386 if (!SplitGUCList(rawstring, ',', &elemlist))
2387 {
2388 /* syntax error in list */
2389 GUC_check_errdetail("List syntax is invalid.");
2392 return false;
2393 }
2394
2395 /* Validate and assign log level and process type. */
2396 foreach_ptr(char, elem, elemlist)
2397 {
2398 char *sep = strchr(elem, ':');
2399
2400 /*
2401 * If there's no ':' separator in the entry, this is the default log
2402 * level. Otherwise it's a process type-specific entry.
2403 */
2404 if (sep == NULL)
2405 {
2406 const struct config_enum_entry *entry;
2407 bool found;
2408
2409 /* Reject duplicates for default log level. */
2410 if (defaultlevel != -1)
2411 {
2412 GUC_check_errdetail("Redundant specification of default log level.");
2413 goto lmm_fail;
2414 }
2415
2416 /* Validate the log level */
2417 found = false;
2418 for (entry = server_message_level_options; entry && entry->name; entry++)
2419 {
2420 if (pg_strcasecmp(entry->name, elem) == 0)
2421 {
2422 defaultlevel = entry->val;
2423 found = true;
2424 break;
2425 }
2426 }
2427
2428 if (!found)
2429 {
2430 GUC_check_errdetail("Unrecognized log level: \"%s\".", elem);
2431 goto lmm_fail;
2432 }
2433 }
2434 else
2435 {
2436 char *loglevel = sep + 1;
2437 char *ptype = elem;
2438 bool found;
2439 int level;
2440 const struct config_enum_entry *entry;
2441
2442 /*
2443 * Temporarily clobber the ':' with a string terminator, so that
2444 * we can validate it. We restore this at the bottom.
2445 */
2446 *sep = '\0';
2447
2448 /* Validate the log level */
2449 found = false;
2450 for (entry = server_message_level_options; entry && entry->name; entry++)
2451 {
2452 if (pg_strcasecmp(entry->name, loglevel) == 0)
2453 {
2454 level = entry->val;
2455 found = true;
2456 break;
2457 }
2458 }
2459
2460 if (!found)
2461 {
2462 GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".",
2463 ptype, loglevel);
2464 goto lmm_fail;
2465 }
2466
2467 /* Is the process type name valid and unique? */
2468 found = false;
2469 for (int i = 0; i < BACKEND_NUM_TYPES; i++)
2470 {
2471 if (pg_strcasecmp(process_types[i], ptype) == 0)
2472 {
2473 /* Reject duplicates for a process type. */
2474 if (assigned[i])
2475 {
2476 GUC_check_errdetail("Redundant log level specification for process type \"%s\".",
2477 ptype);
2478 goto lmm_fail;
2479 }
2480
2481 newlevel[i] = level;
2482 assigned[i] = true;
2483 found = true;
2484
2485 /*
2486 * note: we must keep looking! some process types appear
2487 * multiple times in proctypelist.h.
2488 */
2489 }
2490 }
2491
2492 if (!found)
2493 {
2494 GUC_check_errdetail("Unrecognized process type \"%s\".", ptype);
2495 goto lmm_fail;
2496 }
2497
2498 /* Put the separator back in place */
2499 *sep = ':';
2500 }
2501
2502 /* all good */
2503 continue;
2504
2505lmm_fail:
2508 return false;
2509 }
2510
2511 /*
2512 * The default log level must be specified. It is the fallback value.
2513 */
2514 if (defaultlevel == -1)
2515 {
2516 GUC_check_errdetail("Default log level was not defined.");
2519 return false;
2520 }
2521
2522 /* Apply the default log level to all processes not listed. */
2523 for (int i = 0; i < BACKEND_NUM_TYPES; i++)
2524 {
2525 if (!assigned[i])
2527 }
2528
2529 /*
2530 * Save an ordered representation of the user-specified string, for the
2531 * show_hook.
2532 */
2534
2536 foreach_ptr(char, elem, elemlist)
2537 {
2538 if (foreach_current_index(elem) == 0)
2540 else
2541 appendStringInfo(&buf, ", %s", elem);
2542 }
2543
2544 result = guc_strdup(LOG, buf.data);
2545 if (!result)
2546 {
2547 pfree(buf.data);
2548 return false;
2549 }
2550
2551 guc_free(*newval);
2552 *newval = result;
2553
2556 pfree(buf.data);
2557
2558 /*
2559 * Pass back data for assign_log_min_messages to use.
2560 */
2561 *extra = guc_malloc(LOG, BACKEND_NUM_TYPES * sizeof(int));
2562 if (!*extra)
2563 return false;
2564 memcpy(*extra, newlevel, BACKEND_NUM_TYPES * sizeof(int));
2565
2566 return true;
2567}
uint32 result
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
static int log_min_messages_cmp(const ListCell *a, const ListCell *b)
Definition elog.c:2574
void guc_free(void *ptr)
Definition guc.c:688
char * guc_strdup(int elevel, const char *src)
Definition guc.c:676
const struct config_enum_entry server_message_level_options[]
Definition guc_tables.c:152
void list_sort(List *list, list_sort_comparator cmp)
Definition list.c:1674
#define foreach_current_index(var_or_cell)
Definition pg_list.h:435
#define foreach_ptr(type, var, lst)
Definition pg_list.h:501
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition stringinfo.c:145
void initStringInfoExt(StringInfo str, int initsize)
Definition stringinfo.c:111
void appendStringInfoString(StringInfo str, const char *s)
Definition stringinfo.c:230
Definition guc.h:174
const char * name
Definition guc.h:175
int val
Definition guc.h:176
bool SplitGUCList(char *rawstring, char separator, List **namelist)
Definition varlena.c:3060

References appendStringInfo(), appendStringInfoString(), BACKEND_NUM_TYPES, buf, fb(), foreach_current_index, foreach_ptr, GUC_check_errdetail, guc_free(), guc_malloc(), guc_strdup(), i, initStringInfoExt(), list_free(), list_sort(), LOG, log_min_messages_cmp(), memcpy(), config_enum_entry::name, newval, pfree(), pg_strcasecmp(), result, server_message_level_options, SplitGUCList(), and config_enum_entry::val.

◆ check_log_of_query()

bool check_log_of_query ( ErrorData edata)

Definition at line 3180 of file elog.c.

3181{
3182 /* log required? */
3184 return false;
3185
3186 /* query log wanted? */
3187 if (edata->hide_stmt)
3188 return false;
3189
3190 /* query string available? */
3191 if (debug_query_string == NULL)
3192 return false;
3193
3194 return true;
3195}
static bool is_log_level_output(int elevel, int log_min_level)
Definition elog.c:214
int log_min_error_statement
Definition guc_tables.c:567
const char * debug_query_string
Definition postgres.c:94

References debug_query_string, fb(), is_log_level_output(), and log_min_error_statement.

Referenced by send_message_to_server_log(), write_csvlog(), and write_jsonlog().

◆ CopyErrorData()

ErrorData * CopyErrorData ( void  )

Definition at line 1942 of file elog.c.

1943{
1946
1947 /*
1948 * we don't increment recursion_depth because out-of-memory here does not
1949 * indicate a problem within the error subsystem.
1950 */
1952
1954
1955 /* Copy the struct itself */
1957 memcpy(newedata, edata, sizeof(ErrorData));
1958
1959 /*
1960 * Make copies of separately-allocated strings. Note that we copy even
1961 * theoretically-constant strings such as filename. This is because those
1962 * could point into JIT-created code segments that might get unloaded at
1963 * transaction cleanup. In some cases we need the copied ErrorData to
1964 * survive transaction boundaries, so we'd better copy those strings too.
1965 */
1966 if (newedata->filename)
1967 newedata->filename = pstrdup(newedata->filename);
1968 if (newedata->funcname)
1969 newedata->funcname = pstrdup(newedata->funcname);
1970 if (newedata->domain)
1971 newedata->domain = pstrdup(newedata->domain);
1972 if (newedata->context_domain)
1973 newedata->context_domain = pstrdup(newedata->context_domain);
1974 if (newedata->message)
1975 newedata->message = pstrdup(newedata->message);
1976 if (newedata->detail)
1977 newedata->detail = pstrdup(newedata->detail);
1978 if (newedata->detail_log)
1979 newedata->detail_log = pstrdup(newedata->detail_log);
1980 if (newedata->hint)
1981 newedata->hint = pstrdup(newedata->hint);
1982 if (newedata->context)
1983 newedata->context = pstrdup(newedata->context);
1984 if (newedata->backtrace)
1985 newedata->backtrace = pstrdup(newedata->backtrace);
1986 if (newedata->message_id)
1987 newedata->message_id = pstrdup(newedata->message_id);
1988 if (newedata->schema_name)
1989 newedata->schema_name = pstrdup(newedata->schema_name);
1990 if (newedata->table_name)
1991 newedata->table_name = pstrdup(newedata->table_name);
1992 if (newedata->column_name)
1993 newedata->column_name = pstrdup(newedata->column_name);
1994 if (newedata->datatype_name)
1995 newedata->datatype_name = pstrdup(newedata->datatype_name);
1996 if (newedata->constraint_name)
1997 newedata->constraint_name = pstrdup(newedata->constraint_name);
1998 if (newedata->internalquery)
1999 newedata->internalquery = pstrdup(newedata->internalquery);
2000
2001 /* Use the calling context for string allocation */
2002 newedata->assoc_context = CurrentMemoryContext;
2003
2004 return newedata;
2005}
#define Assert(condition)
Definition c.h:943
#define CHECK_STACK_DEPTH()
Definition elog.c:175
static ErrorData errordata[ERRORDATA_STACK_SIZE]
Definition elog.c:156
#define palloc_object(type)
Definition fe_memutils.h:74
MemoryContext CurrentMemoryContext
Definition mcxt.c:160
MemoryContext ErrorContext
Definition mcxt.c:167

References Assert, CHECK_STACK_DEPTH, CurrentMemoryContext, ErrorContext, errordata, errordata_stack_depth, fb(), memcpy(), palloc_object, and pstrdup().

Referenced by _SPI_commit(), _SPI_rollback(), exec_stmt_block(), GetConnection(), initTrie(), plperl_return_next(), plperl_spi_commit(), plperl_spi_exec(), plperl_spi_exec_prepared(), plperl_spi_fetchrow(), plperl_spi_prepare(), plperl_spi_query(), plperl_spi_query_prepared(), plperl_spi_rollback(), plperl_util_elog(), pltcl_commit(), pltcl_elog(), pltcl_rollback(), pltcl_subtrans_abort(), PLy_commit(), PLy_output(), PLy_rollback(), PLy_spi_subtransaction_abort(), and ReorderBufferProcessTXN().

◆ DebugFileOpen()

void DebugFileOpen ( void  )

Definition at line 2307 of file elog.c.

2308{
2309 int fd,
2310 istty;
2311
2312 if (OutputFileName[0])
2313 {
2314 /*
2315 * A debug-output file name was given.
2316 *
2317 * Make sure we can write the file, and find out if it's a tty.
2318 */
2320 0666)) < 0)
2321 ereport(FATAL,
2323 errmsg("could not open file \"%s\": %m", OutputFileName)));
2324 istty = isatty(fd);
2325 close(fd);
2326
2327 /*
2328 * Redirect our stderr to the debug output file.
2329 */
2330 if (!freopen(OutputFileName, "a", stderr))
2331 ereport(FATAL,
2333 errmsg("could not reopen file \"%s\" as stderr: %m",
2334 OutputFileName)));
2335
2336 /*
2337 * If the file is a tty and we're running under the postmaster, try to
2338 * send stdout there as well (if it isn't a tty then stderr will block
2339 * out stdout, so we may as well let stdout go wherever it was going
2340 * before).
2341 */
2342 if (istty && IsUnderPostmaster)
2343 if (!freopen(OutputFileName, "a", stdout))
2344 ereport(FATAL,
2346 errmsg("could not reopen file \"%s\" as stdout: %m",
2347 OutputFileName)));
2348 }
2349}
int errcode_for_file_access(void)
Definition elog.c:898
#define FATAL
Definition elog.h:42
#define ereport(elevel,...)
Definition elog.h:152
bool IsUnderPostmaster
Definition globals.c:122
char OutputFileName[MAXPGPATH]
Definition globals.c:81
#define close(a)
Definition win32.h:12
static char * errmsg
static int fd(const char *x, int i)

References close, ereport, errcode_for_file_access(), errmsg, FATAL, fb(), fd(), IsUnderPostmaster, and OutputFileName.

Referenced by BaseInit().

◆ EmitErrorReport()

void EmitErrorReport ( void  )

Definition at line 1883 of file elog.c.

1884{
1886 MemoryContext oldcontext;
1887
1890 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1891
1892 /*
1893 * Reset the formatted timestamp fields before emitting any logs. This
1894 * includes all the log destinations and emit_log_hook, as the latter
1895 * could use log_line_prefix or the formatted timestamps.
1896 */
1897 saved_timeval_set = false;
1898 formatted_log_time[0] = '\0';
1899
1900 /*
1901 * Call hook before sending message to log. The hook function is allowed
1902 * to turn off edata->output_to_server, so we must recheck that afterward.
1903 * Making any other change in the content of edata is not considered
1904 * supported.
1905 *
1906 * Note: the reason why the hook can only turn off output_to_server, and
1907 * not turn it on, is that it'd be unreliable: we will never get here at
1908 * all if errstart() deems the message uninteresting. A hook that could
1909 * make decisions in that direction would have to hook into errstart(),
1910 * where it would have much less information available. emit_log_hook is
1911 * intended for custom log filtering and custom log message transmission
1912 * mechanisms.
1913 *
1914 * The log hook has access to both the translated and original English
1915 * error message text, which is passed through to allow it to be used as a
1916 * message identifier. Note that the original text is not available for
1917 * detail, detail_log, hint and context text elements.
1918 */
1919 if (edata->output_to_server && emit_log_hook)
1920 (*emit_log_hook) (edata);
1921
1922 /* Send to server log, if enabled */
1923 if (edata->output_to_server)
1925
1926 /* Send to client, if enabled */
1927 if (edata->output_to_client)
1929
1930 MemoryContextSwitchTo(oldcontext);
1932}
static char formatted_log_time[FORMATTED_TS_LEN]
Definition elog.c:171
static void send_message_to_frontend(ErrorData *edata)
Definition elog.c:3979
static bool saved_timeval_set
Definition elog.c:167
static int recursion_depth
Definition elog.c:160
emit_log_hook_type emit_log_hook
Definition elog.c:111
static void send_message_to_server_log(ErrorData *edata)
Definition elog.c:3675
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition palloc.h:124

References CHECK_STACK_DEPTH, emit_log_hook, errordata, errordata_stack_depth, fb(), formatted_log_time, MemoryContextSwitchTo(), recursion_depth, saved_timeval_set, send_message_to_frontend(), and send_message_to_server_log().

Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), BackgroundWorkerMain(), BackgroundWriterMain(), CheckpointerMain(), DisableSubscriptionAndExit(), do_autovacuum(), errfinish(), IoWorkerMain(), perform_work_item(), pgarch_archiveXlog(), PostgresMain(), ReplSlotSyncWorkerMain(), WalSummarizerMain(), and WalWriterMain().

◆ err_gettext()

static const char * err_gettext ( const char str)
inlinestatic

Definition at line 318 of file elog.c.

319{
320#ifdef ENABLE_NLS
322 return str;
323 else
324 return gettext(str);
325#else
326 return str;
327#endif
328}
#define gettext(x)
Definition c.h:1268

References gettext, in_error_recursion_trouble(), and str.

◆ err_sendstring()

static void err_sendstring ( StringInfo  buf,
const char str 
)
static

Definition at line 3967 of file elog.c.

3968{
3971 else
3973}
void pq_sendstring(StringInfo buf, const char *str)
Definition pqformat.c:195
void pq_send_ascii_string(StringInfo buf, const char *str)
Definition pqformat.c:227

References buf, in_error_recursion_trouble(), pq_send_ascii_string(), pq_sendstring(), and str.

Referenced by send_message_to_frontend().

◆ errbacktrace()

int errbacktrace ( void  )

Definition at line 1116 of file elog.c.

1117{
1119 MemoryContext oldcontext;
1120
1123 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1124
1125 set_backtrace(edata, 1);
1126
1127 MemoryContextSwitchTo(oldcontext);
1129
1130 return 0;
1131}
static pg_noinline void set_backtrace(ErrorData *edata, int num_skip)
Definition elog.c:1147

References CHECK_STACK_DEPTH, errordata, errordata_stack_depth, fb(), MemoryContextSwitchTo(), recursion_depth, and set_backtrace().

◆ errcode()

int errcode ( int  sqlerrcode)

Definition at line 875 of file elog.c.

876{
878
879 /* we don't bother incrementing recursion_depth */
881
882 edata->sqlerrcode = sqlerrcode;
883
884 return 0; /* return value does not matter */
885}

References CHECK_STACK_DEPTH, errordata, errordata_stack_depth, and fb().

Referenced by _arrq_cons(), _bt_binsrch_insert(), _bt_check_third_page(), _bt_check_unique(), _bt_checkpage(), _bt_get_endpoint(), _bt_getmeta(), _bt_gettrueroot(), _bt_insert_parent(), _bt_insertonpg(), _bt_lock_subtree_parent(), _bt_mark_page_halfdead(), _bt_pagedel(), _bt_preprocess_array_keys_final(), _bt_split(), _bt_unlink_halfdead_page(), _crypt_blowfish_rn(), _crypt_gensalt_sha(), _hash_addovflpage(), _hash_checkpage(), _hash_doinsert(), _hash_first(), _hash_init(), _hash_ovflblkno_to_bitno(), _intbig_in(), _intbig_out(), _lca(), _lt_q_regex(), _ltree_compress(), _PG_init(), _SPI_commit(), _SPI_execute_plan(), _SPI_rollback(), _tarWriteHeader(), AbortBufferIO(), AbsorbDataChecksumsBarrier(), accumArrayResult(), accumArrayResultArr(), aclcheck_error(), aclcheck_error_col(), aclinsert(), aclitemin(), aclparse(), aclremove(), add_guc_variable(), add_json(), add_jsonb(), add_parameter_name(), add_reloption_kind(), add_size(), addCompoundAffixFlagValue(), AddEnumLabel(), addFamilyMember(), addFkConstraint(), addFkRecurseReferencing(), AddQual(), addRangeTableEntryForCTE(), addRangeTableEntryForFunction(), addRangeTableEntryForGraphTable(), addRangeTableEntryForJoin(), addRangeTableEntryForSubquery(), addRangeTableEntryForTableFunc(), addRangeTableEntryForValues(), AddRelationNewConstraints(), AddRelationNotNullConstraints(), AddRoleMems(), addTargetToSortList(), addUnicode(), addUnicodeChar(), AdjustIntervalForTypmod(), AdjustNotNullInheritance(), AdjustTimestampForTypmod(), advance_windowaggregate(), afterTriggerMarkEvents(), AfterTriggerSetState(), AggregateCreate(), alen_object_start(), alen_scalar(), AllocateDir(), AllocateFile(), AllocateVfd(), AllocSetContextCreateInternal(), AlterCheckConstrEnforceabilityRecurse(), AlterDatabase(), AlterDatabaseOwner(), AlterDatabaseRefreshColl(), AlterDomainDropConstraint(), AlterDomainValidateConstraint(), AlterEventTrigger(), AlterEventTriggerOwner(), AlterEventTriggerOwner_internal(), AlterEventTriggerOwner_oid(), AlterExtensionNamespace(), AlterForeignDataWrapper(), AlterForeignDataWrapperOwner(), AlterForeignDataWrapperOwner_internal(), AlterForeignDataWrapperOwner_oid(), AlterForeignServer(), AlterForeignServerOwner(), AlterForeignServerOwner_oid(), AlterFunction(), AlterObjectNamespace_internal(), AlterObjectRename_internal(), AlterOperator(), AlterOpFamily(), AlterOpFamilyAdd(), AlterOpFamilyDrop(), AlterPolicy(), AlterPropGraph(), AlterPublication(), AlterPublicationOptions(), AlterPublicationOwner(), AlterPublicationOwner_internal(), AlterPublicationOwner_oid(), AlterPublicationSchemas(), AlterRelationNamespaceInternal(), AlterReplicationSlot(), AlterRole(), AlterRoleSet(), AlterSchemaOwner(), AlterStatistics(), AlterSubscription(), AlterSubscription_refresh(), AlterSubscription_refresh_seq(), AlterSubscriptionOwner(), AlterSubscriptionOwner_internal(), AlterSubscriptionOwner_oid(), AlterSystemSetConfigFile(), AlterTableMoveAll(), AlterTableNamespace(), AlterTableSpaceOptions(), AlterTSConfiguration(), AlterType(), AlterTypeNamespace(), AlterTypeNamespace_oid(), AlterTypeNamespaceInternal(), AlterTypeOwner(), AlterTypeOwnerInternal(), AlterUserMapping(), amcheck_index_mainfork_expected(), amcheck_lock_relation_and_check(), analyzeCTE(), analyzeCTETargetList(), anybit_typmodin(), anychar_typmodin(), anytime_typmod_check(), anytime_typmodin(), anytimestamp_typmod_check(), anytimestamp_typmodin(), appendElement(), appendKey(), apply_dispatch(), apply_handle_begin_prepare(), apply_handle_commit(), apply_handle_origin(), apply_handle_prepare(), apply_handle_stream_abort(), apply_handle_stream_commit(), apply_handle_stream_prepare(), apply_handle_stream_start(), apply_handle_stream_stop(), apply_typmod(), apply_typmod_special(), ApplyRetrieveRule(), apw_start_database_worker(), apw_start_leader_worker(), array_agg_array_combine(), array_agg_array_transfn(), array_agg_deserialize(), array_agg_transfn(), array_append(), array_cat(), array_cmp(), array_contain_compare(), array_eq(), array_exec_setup(), array_fill(), array_fill_internal(), array_fill_with_lower_bounds(), array_from_column_list(), array_get_slice(), array_in(), array_in_safe(), array_iterator(), array_map(), array_position_common(), array_positions(), array_prepend(), array_recv(), array_replace_internal(), array_sample(), array_send(), array_set_element(), array_set_element_expanded(), array_set_slice(), array_sort_internal(), array_subscript_check_subscripts(), array_subscript_transform(), array_to_datum_internal(), array_to_tsvector(), ArrayCheckBoundsSafe(), ArrayGetIntegerTypmods(), ArrayGetNItemsSafe(), arrq_cons(), ascii(), ASN1_STRING_to_text(), assign_collations_walker(), assign_hypothetical_collations(), assign_record_type_identifier(), assignable_custom_variable_name(), assignOperTypes(), assignProcTypes(), AssignTransactionId(), AssignTypeArrayOid(), AssignTypeMultirangeArrayOid(), AssignTypeMultirangeOid(), Async_Notify(), ATAddCheckNNConstraint(), ATAddForeignKeyConstraint(), AtEOSubXact_SPI(), AtEOXact_SPI(), ATExecAddColumn(), ATExecAddConstraint(), ATExecAddIdentity(), ATExecAddIndexConstraint(), ATExecAddInherit(), ATExecAddOf(), ATExecAlterCheckConstrEnforceability(), ATExecAlterColumnGenericOptions(), ATExecAlterColumnType(), ATExecAlterConstraint(), ATExecAttachPartition(), ATExecAttachPartitionIdx(), ATExecChangeOwner(), ATExecClusterOn(), ATExecColumnDefault(), ATExecDetachPartition(), ATExecDropColumn(), ATExecDropConstraint(), ATExecDropExpression(), ATExecDropIdentity(), ATExecDropNotNull(), ATExecDropOf(), ATExecGenericOptions(), ATExecMergePartitions(), ATExecReplicaIdentity(), ATExecSetCompression(), ATExecSetExpression(), ATExecSetIdentity(), ATExecSetNotNull(), ATExecSetOptions(), ATExecSetRelOptions(), ATExecSetStatistics(), ATExecSetStorage(), ATExecSplitPartition(), ATExecValidateConstraint(), ATPrepAddColumn(), ATPrepAlterColumnType(), AtPrepare_Locks(), AtPrepare_Notify(), AtPrepare_RelationMap(), ATPrepChangeInherit(), ATPrepChangePersistence(), ATPrepCmd(), ATPrepDropColumn(), ATPrepDropExpression(), ATPrepSetTableSpace(), ATRewriteTable(), ATRewriteTables(), ATSimplePermissions(), AtSubCommit_childXids(), attach_internal(), AttachPartitionEnsureIndexes(), attribute_statistics_update(), auth_failed(), auth_peer(), autoinc(), autoprewarm_database_main(), autoprewarm_start_worker(), BackendInitialize(), BackendStartup(), BackgroundWorkerInitializeConnection(), BackgroundWorkerInitializeConnectionByOid(), BackgroundWorkerStateChange(), base32hex_decode(), BaseBackupGetTargetHandle(), BasicOpenFilePerm(), bbsink_gzip_new(), bbsink_lz4_new(), bbsink_server_archive_contents(), bbsink_server_manifest_contents(), bbsink_server_new(), bbsink_zstd_new(), be_lo_close(), be_lo_get_fragment(), be_lo_lseek(), be_lo_lseek64(), be_lo_tell(), be_lo_tell64(), be_lo_unlink(), be_tls_init(), be_tls_open_server(), be_tls_read(), be_tls_write(), before_shmem_exit(), begin_prepare_cb_wrapper(), BeginCopyFrom(), BeginCopyTo(), BeginTransactionBlock(), bernoulli_beginsamplescan(), binary_decode(), binary_encode(), bit(), bit_and(), bit_catenate(), bit_in(), bit_or(), bit_overlay(), bit_recv(), bitgetbit(), bitsetbit(), bitsubstring(), bittoint4(), bittoint8(), bitxor(), bloom_get_procinfo(), blvalidate(), boolin(), BootstrapModeMain(), bpchar(), bpchar_input(), bqarr_in(), bqarr_out(), brin_bloom_summary_in(), brin_bloom_summary_recv(), brin_desummarize_range(), brin_doinsert(), brin_doupdate(), brin_getinsertbuffer(), brin_metapage_info(), brin_minmax_multi_summary_in(), brin_minmax_multi_summary_recv(), brin_page_items(), brin_page_type(), brin_revmap_data(), brin_summarize_range(), brinGetTupleForHeapBlock(), brininsert(), brinRevmapDesummarizeRange(), brinvalidate(), bt_check_every_level(), bt_check_level_from_leftmost(), bt_child_check(), bt_child_highkey_check(), bt_downlink_missing_check(), bt_entry_unique_check(), bt_index_block_validate(), bt_index_check_callback(), bt_leftmost_ignoring_half_dead(), bt_metap(), bt_multi_page_stats(), bt_normalize_tuple(), bt_page_items_bytea(), bt_page_items_internal(), bt_page_stats_internal(), bt_recheck_sibling_links(), bt_report_duplicate(), bt_right_page_check_scankey(), bt_target_page_check(), bt_tuple_present_callback(), BTreeTupleGetHeapTIDCareful(), btvacuumpage(), btvalidate(), buffer_readv_report(), build_attrmap_by_name(), build_attrmap_by_position(), build_column_default(), build_datatype(), build_mvdependencies(), build_mvndistinct(), build_server_first_message(), build_tuplestore_recursively(), BuildDescForRelation(), buildRelationAliases(), BuildRelationExtStatistics(), builtin_locale_encoding(), builtin_validate_locale(), BumpContextCreate(), bytea_int2(), bytea_int4(), bytea_int8(), bytea_overlay(), bytea_substring(), bytea_uuid(), byteaGetBit(), byteaGetByte(), byteain(), byteaout(), byteaSetBit(), byteaSetByte(), calc_rank_cd(), calculate_frame_offsets(), call_bool_check_hook(), call_enum_check_hook(), call_int_check_hook(), call_pltcl_start_proc(), call_real_check_hook(), call_string_check_hook(), cannotCastJsonbValue(), cash_dist(), cash_div_cash(), cash_div_float8(), cash_div_int64(), cash_in(), cash_mi_cash(), cash_mul_float8(), cash_mul_int64(), cash_pl_cash(), CastCreate(), cfunc_resolve_polymorphic_argtypes(), changeDependenciesOn(), char2wchar(), check_acl(), check_agg_arguments(), check_agg_arguments_walker(), check_agglevels_and_constraints(), check_all_expr_argnames_valid(), check_and_init_gencol(), check_and_set_sync_info(), check_av_worker_gucs(), check_can_set_role(), check_circularity(), check_collation_set(), check_collation_set(), check_concurrent_repack_requirements(), check_conn_params(), check_default_partition_contents(), check_default_table_access_method(), check_default_tablespace(), check_default_text_search_config(), check_duplicates_in_publist(), check_element_label_properties(), check_element_properties(), check_enable_rls(), check_encoding_locale_matches(), check_exclusion_or_unique_constraint(), check_for_column_name_collision(), check_foreign_key(), check_ident_usermap(), check_index_is_clusterable(), check_index_page(), check_lateral_ref_ok(), check_locale(), check_mcvlist_array(), check_nested_generated_walker(), check_new_partition_bound(), check_oauth_validator(), check_object_ownership(), check_of_type(), check_parameter_resolution_walker(), check_parent_values_in_new_partitions(), check_partition_bounds_for_split_list(), check_partition_bounds_for_split_range(), check_partitions_not_overlap_list(), check_password(), check_primary_key(), check_pub_dead_tuple_retention(), check_publication_add_relation(), check_publication_add_schema(), check_publications(), check_publications_origin_sequences(), check_publications_origin_tables(), check_relation_block_range(), check_relation_privileges(), check_relation_relkind(), check_relation_updatable(), check_restricted_library_name(), check_role(), check_role_grantor(), check_role_membership_authorization(), check_rolespec_name(), check_safe_enum_use(), check_session_authorization(), check_simple_rowfilter_expr_walker(), check_sql_fn_statement(), check_sql_stmt_retval(), check_srf_call_placement(), check_ssl_key_file_permissions(), check_stack_depth(), check_temp_tablespaces(), check_transform_function(), check_two_partitions_bounds_range(), check_unicode_value(), check_valid_extension_name(), check_valid_int2vector(), check_valid_oidvector(), check_valid_version_name(), check_validator_hba_options(), check_virtual_generated_security_walker(), CheckAlterPublication(), CheckAlterSubOption(), CheckAlterTableIsSafe(), CheckAndGetDbnameFromConninfo(), CheckAttributeNamesTypes(), CheckAttributeType(), CheckCmdReplicaIdentity(), checkDataDir(), checkDomainOwner(), CheckDuplicateColumnOrPathNames(), checkEnumOwner(), checkExprIsVarFree(), CheckForSerializableConflictIn(), CheckForSerializableConflictOut(), CheckForSerializableConflictOutNeeded(), CheckForSessionAndXactLocks(), CheckFunctionValidatorAccess(), CheckIndexCompatible(), checkInsertTargets(), checkJsonOutputFormat(), CheckLogicalDecodingRequirements(), checkMembershipInCurrentExtension(), CheckMyDatabase(), checkNameSpaceConflicts(), checkPartition(), CheckPredicate(), CheckPubRelationColumnList(), CheckRecoveryConflictDeadlock(), CheckRelationTableSpaceMove(), CheckRequiredParameterValues(), CheckRestrictedOperation(), checkRuleResultList(), CheckSASLAuth(), checkSchemaNameList(), checkSchemaNameRV(), CheckSelectLocking(), CheckSetNamespace(), checkSharedDependencies(), CheckSlotPermissions(), CheckSlotRequirements(), checkStringLen(), CheckSubDeadTupleRetention(), CheckSubscriptionRelkind(), CheckTableNotInUse(), CheckTablespaceDirectory(), checkTargetlistEntrySQL92(), checkTimezoneIsUsedForCast(), CheckTransactionBlock(), CheckValidResultRel(), CheckValidRowMarkRel(), CheckVarSlotCompatibility(), checkViewColumns(), checkWellFormedRecursion(), checkWellFormedRecursionWalker(), chr(), cidr_abbrev(), cidr_set_masklen(), circle_in(), circle_poly_internal(), circle_recv(), ClientAuthentication(), CloneFkReferencing(), ClosePipeFromProgram(), ClosePipeToProgram(), cluster_rel(), coerce_record_to_complex(), coerce_to_boolean(), coerce_to_common_type(), coerce_to_specific_type_typmod(), coerceJsonFuncExpr(), CollationCreate(), collectMatchBitmap(), collectPartitionIndexExtDeps(), colNameToVar(), CommandCounterIncrement(), CommentObject(), commit_prepared_cb_wrapper(), comparetup_index_btree_tiebreak(), compatConnectbyTupleDescs(), compatCrosstabTupleDescs(), compatible_oper(), compile_plperl_function(), compile_pltcl_function(), compileTheLexeme(), compileTheSubstitute(), complex_in(), compute_common_attribute(), compute_function_attributes(), compute_return_type(), ComputeIndexAttrs(), ComputePartitionAttrs(), connect_pg_server(), connectby_text(), connectby_text_serial(), ConstraintSetParentConstraint(), construct_md_array(), constructSetOpTargetlist(), ConversionCreate(), convert_and_check_filename(), convert_any_priv_string(), convert_column_name(), convert_function_name(), convert_type_name(), convertJsonbArray(), convertJsonbObject(), cookConstraint(), cookDefault(), copy_replication_slot(), copy_sequences(), copy_table(), CopyFrom(), CopyFromBinaryOneRow(), CopyFromTextLikeOneRow(), CopyGetAttnums(), CopyGetData(), CopyReadAttributesCSV(), CopyReadAttributesText(), CopyReadBinaryAttribute(), CopyReadLineText(), CopyXLogRecordToWAL(), countVariablesFromJsonb(), create_ctas_nodata(), create_distinct_paths(), create_ordinary_grouping_paths(), create_pg_locale_icu(), create_tablespace_directories(), CreateAccessMethod(), CreateCast(), CreateConversionCommand(), createdb(), CreateDecodingContext(), CreateEventTrigger(), CreateExtension(), CreateExtensionInternal(), CreateForeignDataWrapper(), CreateForeignServer(), CreateFunction(), CreateInheritance(), CreateInitDecodingContext(), CreateLockFile(), createNewConnection(), CreateOpFamily(), createPartitionTable(), CreatePolicy(), CreatePortal(), CreatePredicateLock(), CreateProceduralLanguage(), CreatePropGraph(), CreatePublication(), CreateRole(), CreateSchemaCommand(), CreateStatistics(), CreateSubscription(), CreateTableAsRelExists(), CreateTableSpace(), CreateTransform(), CreateTriggerFiringOn(), CreateUserMapping(), crosstab(), crosstab_hash(), cube_a_f8(), cube_a_f8_f8(), cube_c_f8(), cube_c_f8_f8(), cube_coord(), cube_coord_llur(), cube_recv(), cube_subset(), cube_yyerror(), currtid_for_view(), currtid_internal(), currval_oid(), cursor_to_xml(), cursor_to_xmlschema(), dacos(), dacosd(), dacosh(), dasin(), dasind(), DataChecksumsWorkerLauncherMain(), datanh(), date2timestamp_safe(), date2timestamptz_safe(), date_in(), date_mi(), date_mii(), date_pli(), date_random(), date_recv(), daterange_canonical(), datetime_timestamp(), DateTimeParseError(), datetimetz_timestamptz(), datum_to_json_internal(), datum_to_jsonb_internal(), datumGetSize(), db_encoding_convert(), dblink_build_sql_delete(), dblink_build_sql_insert(), dblink_build_sql_update(), dblink_conn_not_avail(), dblink_connect(), dblink_connstr_check(), dblink_exec(), dblink_fdw_validator(), dblink_fetch(), dblink_get_conn(), dblink_res_error(), dblink_security_check(), DCH_from_char(), DCH_to_char(), dcos(), dcosd(), dcot(), dcotd(), DeadLockReport(), DecodeTimezoneName(), deconstruct_array(), DeconstructQualifiedName(), defGetBoolean(), defGetCopyHeaderOption(), defGetCopyLogVerbosityChoice(), defGetCopyOnErrorChoice(), defGetCopyRejectLimitOption(), defGetGeneratedColsOption(), defGetInt32(), defGetInt64(), defGetNumeric(), defGetObjectId(), defGetQualifiedName(), defGetStreamingMode(), defGetString(), defGetStringList(), defGetTypeLength(), defGetTypeName(), define_custom_variable(), DefineAggregate(), DefineCollation(), DefineCompositeType(), DefineDomain(), DefineEnum(), DefineIndex(), DefineOpClass(), DefineOperator(), DefineOpFamily(), DefineQueryRewrite(), DefineRange(), DefineRelation(), DefineSavepoint(), DefineSequence(), DefineTSConfiguration(), DefineTSDictionary(), DefineTSParser(), DefineTSTemplate(), DefineType(), DefineView(), DefineVirtualRelation(), deleteConnection(), DeleteInheritsTuple(), dependencies_array_element_start(), dependencies_array_end(), dependencies_array_start(), dependencies_object_end(), dependencies_object_field_start(), dependencies_object_start(), dependencies_scalar(), deserialize_deflist(), destroy_tablespace_directories(), determine_clustered_index(), DetermineTimeZoneAbbrevOffsetTS(), dintdict_init(), disable_data_checksums(), dispell_init(), div_var(), div_var_int(), dlog1(), dlog10(), do_pg_backup_start(), do_pg_backup_stop(), do_to_timestamp(), DoCopy(), domain_check_input(), domain_state_setup(), domainAddCheckConstraint(), domainAddNotNullConstraint(), DoPortalRewind(), dpow(), DropConfigurationMapping(), dropconstraint_internal(), DropDatabase(), dropdb(), DropErrorMsgNonExistent(), DropErrorMsgWrongType(), dropOperators(), DropOwnedObjects(), dropProcedures(), DropRole(), DropSubscription(), DropTableSpace(), dsa_allocate_extended(), dsa_attach(), dsa_get_total_size_from_handle(), dshash_create(), dsimple_init(), dsin(), dsind(), dsm_backend_startup(), dsm_create(), dsnowball_init(), dsqrt(), dsynonym_init(), dtan(), dtand(), dtoi2(), dtoi4(), dtoi8(), dummy_object_relabel(), dumptuples(), dxsyn_init(), EA_get_flat_size(), each_array_start(), each_scalar(), each_worker_jsonb(), ean2isn(), ean2string(), elements_object_start(), elements_scalar(), elements_worker_jsonb(), emit_audit_message(), enable_data_checksums(), EnableDisableRule(), EnableDisableTrigger(), EnableLockPagesPrivilege(), encrypt_password(), EndPrepare(), EndTransactionBlock(), enforce_generic_type_consistency(), enlarge_trgm_array(), enlargeStringInfo(), entry_reset(), enum_cmp_internal(), enum_first(), enum_in(), enum_last(), enum_out(), enum_range_all(), enum_range_bounds(), enum_recv(), enum_send(), EnumValuesCreate(), errcode_apply_conflict(), errcode_for_dynamic_shared_memory(), errno_from_string(), error_commit_ts_disabled(), error_duplicate_filter_variable(), error_multiple_recovery_targets(), error_view_not_updatable(), errorConflictingDefElem(), errorMissingColumn(), errorMissingRTE(), esc_dec_len(), esc_decode(), EvalPlanQualFetchRowMark(), evaluateGeneratedExpressionsAndCheckConstraints(), EvaluateParams(), exec_assign_value(), exec_bind_message(), exec_check_assignable(), exec_describe_portal_message(), exec_describe_statement_message(), exec_dynquery_with_params(), exec_eval_datum(), exec_eval_expr(), exec_execute_message(), exec_init_tuple_store(), exec_move_row_from_fields(), exec_object_restorecon(), exec_parse_message(), exec_replication_command(), exec_run_select(), exec_simple_query(), exec_stmt_assert(), exec_stmt_case(), exec_stmt_close(), exec_stmt_dynexecute(), exec_stmt_execsql(), exec_stmt_fetch(), exec_stmt_forc(), exec_stmt_foreach_a(), exec_stmt_fori(), exec_stmt_getdiag(), exec_stmt_open(), exec_stmt_raise(), exec_stmt_return(), exec_stmt_return_next(), exec_stmt_return_query(), ExecAlterDefaultPrivilegesStmt(), ExecAlterExtensionContentsRecurse(), ExecAlterExtensionContentsStmt(), ExecAlterExtensionStmt(), ExecARDeleteTriggers(), ExecARInsertTriggers(), ExecARUpdateTriggers(), ExecBRInsertTriggers(), ExecBSDeleteTriggers(), ExecBSInsertTriggers(), ExecBSTruncateTriggers(), ExecBSUpdateTriggers(), ExecBuildUpdateProjection(), ExecCallTriggerFunc(), ExecCheckIndexConstraints(), ExecCheckPlanOutput(), ExecCheckpoint(), ExecCheckTupleVisible(), ExecConstraints(), ExecCrossPartitionUpdate(), ExecCrossPartitionUpdateForeignKey(), execCurrentOf(), ExecCustomMarkPos(), ExecCustomRestrPos(), ExecDelete(), ExecEvalArrayExpr(), ExecEvalConstraintCheck(), ExecEvalConstraintNotNull(), ExecEvalCurrentOfExpr(), ExecEvalFieldSelect(), ExecEvalJsonCoercionFinish(), ExecEvalJsonExprPath(), ExecEvalParamExtern(), ExecEvalWholeRowVar(), ExecFindPartition(), ExecGrant_Language_check(), ExecGrant_Relation(), ExecGrant_Type_check(), ExecInitAgg(), ExecInitExprRec(), ExecInitFunc(), ExecInitMergeJoin(), ExecInitSubscriptingRef(), ExecLockRows(), ExecMakeFunctionResultSet(), ExecMakeTableFunctionResult(), ExecMergeMatched(), ExecOnConflictLockRow(), ExecOpenScanRelation(), ExecPartitionCheckEmitError(), ExecPrepareTuplestoreResult(), ExecReindex(), ExecRepack(), ExecScanSubPlan(), ExecSecLabelStmt(), ExecSetParamPlan(), ExecSetVariableStmt(), ExecUpdate(), execute_extension_script(), execute_sql_string(), executeBinaryArithmExpr(), ExecuteCallStmt(), executeDateTimeMethod(), ExecuteDoStmt(), ExecuteGrantStmt(), executeItemOptUnwrapTarget(), executeKeyValueMethod(), executeNumericItemMethod(), ExecuteQuery(), executeStringInternalMethod(), ExecuteTruncate(), executeUnaryArithmExpr(), ExecVacuum(), ExecWaitStmt(), ExecWithCheckOptions(), ExecWithoutOverlapsNotEmpty(), ExitPostmaster(), exp_var(), expand_col_privileges(), expand_vacuum_rel(), ExpandAllTables(), ExpandColumnRefStar(), expandTableLikeClause(), ExportSnapshot(), exprType(), ExtendBufferedRelLocal(), ExtendBufferedRelShared(), extended_statistics_update(), extract_date(), extract_variadic_args(), ExtractExtensionList(), extractModify(), FastPathGetRelationLockEntry(), fatal_llvm_error_handler(), fatal_llvm_new_handler(), fatal_system_new_handler(), fetch_array_arg_replace_nulls(), fetch_cursor_param_value(), fetch_finfo_record(), fetch_fp_info(), fetch_relation_list(), fetch_remote_table_info(), FetchPreparedStatement(), file_fdw_validator(), fileIterateForeignScan(), FileWriteV(), finalize_grouping_exprs_walker(), find_composite_type_dependencies(), find_expr_references_walker(), find_in_path(), find_in_paths(), find_my_exec(), find_option(), find_provider(), find_typed_table_dependencies(), FindDeletedTupleInLocalRel(), findDependentObjects(), FindFKPeriodOpers(), findRangeCanonicalFunction(), findRangeSubOpclass(), findRangeSubtypeDiffFunction(), findTargetlistEntrySQL92(), findTypeAnalyzeFunction(), findTypeInputFunction(), findTypeOutputFunction(), findTypeReceiveFunction(), findTypeSendFunction(), findTypeSubscriptingFunction(), findTypeTypmodinFunction(), findTypeTypmodoutFunction(), finish_nodeitem(), finite_interval_mi(), finite_interval_pl(), fireRIRrules(), fixed_paramref_hook(), flatten_set_variable_args(), flattenJsonPathParseItem(), float4in_internal(), float8_timestamptz(), float8in_internal(), float_overflow_error(), float_overflow_error_ext(), float_underflow_error(), float_underflow_error_ext(), float_zero_divide_error(), float_zero_divide_error_ext(), FloatExceptionHandler(), fmgr_info_cxt_security(), fmgr_internal_validator(), fmgr_sql(), fmgr_sql_validator(), forbidden_in_wal_sender(), ForeignServerConnectionString(), forkname_to_number(), free_parsestate(), FreezeMultiXactId(), from_char_parse_int_len(), from_char_seq_search(), from_char_set_int(), from_char_set_mode(), fsm_page_contents(), ftoi2(), ftoi4(), ftoi8(), func_select_candidate(), g_cube_distance(), g_int_compress(), g_int_decompress(), gai_strerror(), gbtreekey_in(), gbtreekey_out(), gen_random_uuid(), generate_error_response(), generate_nonunion_paths(), generate_queries_for_path_pattern(), generate_recursion_path(), generate_series_step_int4(), generate_series_step_int8(), generate_series_step_numeric(), generate_series_timestamp(), generate_series_timestamptz_internal(), generate_uuidv7(), generateClonedIndexStmt(), generateSerialExtraStmts(), GenerationContextCreate(), Generic_Text_IC_like(), GenericMatchText(), get_am_type_oid(), get_cached_rowtype(), get_cast_oid(), get_collation_actual_version_builtin(), get_collation_oid(), get_connect_string(), get_controlfile_by_exact_path(), get_conversion_oid(), get_crosstab_tuplestore(), get_database_oid(), get_domain_constraint_oid(), get_edge_oid(), get_event_trigger_oid(), get_expr_result_tupdesc(), get_extension_oid(), get_fn_opclass_options(), get_foreign_data_wrapper_oid(), get_foreign_server_oid(), get_func_expr(), get_language_oid(), get_multirange_io_data(), get_namespace_oid(), get_object_address(), get_object_address_attrdef(), get_object_address_attribute(), get_object_address_defacl(), get_object_address_opf_member(), get_object_address_publication_rel(), get_object_address_publication_schema(), get_object_address_relobject(), get_object_address_type(), get_object_address_usermapping(), get_page_from_raw(), get_path_elements_for_path_factor(), get_publication_oid(), get_range_io_data(), get_raw_page_1_9(), get_raw_page_fork_1_9(), get_raw_page_internal(), get_record_type_from_argument(), get_record_type_from_query(), get_relation_by_qualified_name(), get_relation_constraint_attnos(), get_relation_constraint_oid(), get_relation_info(), get_relation_policy_oid(), get_required_extension(), get_rewrite_oid(), get_role_oid(), get_rolespec_oid(), get_rolespec_tuple(), get_rte_attribute_is_dropped(), get_sort_group_operators(), get_sql_insert(), get_sql_update(), get_statistics_object_oid(), get_subscription_oid(), get_tablespace_location(), get_tablespace_oid(), get_th(), get_transform_oid(), get_trigger_oid(), get_ts_config_oid(), get_ts_dict_oid(), get_ts_parser_func(), get_ts_parser_oid(), get_ts_template_func(), get_ts_template_oid(), get_tsearch_config_filename(), get_tuple_of_interest(), get_vertex_oid(), get_windowfunc_expr_helper(), getAffixFlagSet(), getArrayIndex(), GetAttributeCompression(), GetAttributeStorage(), GetColumnDefCollation(), GetConfFilesInDir(), GetConfigOption(), GetConfigOptionByName(), GetConfigOptionResetString(), GetConflictingVirtualXIDs(), GetCurrentCommandId(), GetCurrentTimeUsec(), getdatafield(), GetDefaultOpClass(), GetDefaultTablespace(), GetExtensibleNodeEntry(), GetFdwRoutine(), GetFdwRoutineByServerId(), GetFileBackupMethod(), getid(), GetIndexAmRoutineByAmId(), getJsonPathVariable(), GetLocalVictimBuffer(), GetMultiXactIdMembers(), GetNewMultiXactId(), GetNewTransactionId(), getNextFlagFromString(), GetOldestUnsummarizedLSN(), GetOperatorFromCompareType(), GetRunningTransactionData(), GetSafeSnapshot(), GetSerializableTransactionSnapshot(), GetSerializableTransactionSnapshotInt(), GetSnapshotData(), GetSubscription(), gettoken_query(), gettoken_query_standard(), gettoken_tsvector(), getTokenTypes(), GetTupleForTrigger(), getTypeBinaryInputInfo(), getTypeBinaryOutputInfo(), getTypeInputInfo(), getTypeOutputInfo(), GetUserMapping(), GetUserNameFromId(), GetWALBlockInfo(), getWeights(), ghstore_in(), ghstore_out(), gin_check_parent_keys_consistency(), gin_check_posting_tree_parent_keys_consistency(), gin_clean_pending_list(), gin_leafpage_items(), gin_metapage_info(), gin_page_opaque_info(), ginadjustmembers(), GinBufferInit(), ginCombineData(), GinFormTuple(), ginNewScanKey(), ginvalidate(), gist_page_items(), gist_page_items_bytea(), gist_page_opaque_info(), gistadjustmembers(), gistcheckpage(), gistSplit(), gistUserPicksplit(), gistvalidate(), GrantRole(), grouping_planner(), gtrgm_in(), gtrgm_out(), gtsvectorin(), guc_malloc(), guc_realloc(), handle_streamed_transaction(), HandleConcurrentAbort(), HandleFunctionRequest(), HandleUploadManifestPacket(), has_sequence_privilege_id(), has_sequence_privilege_id_id(), has_sequence_privilege_id_name(), has_sequence_privilege_name(), has_sequence_privilege_name_id(), has_sequence_privilege_name_name(), hash_array(), hash_array_extended(), hash_array_start(), hash_bitmap_info(), hash_create(), hash_metapage_info(), hash_multirange(), hash_multirange_extended(), hash_page_items(), hash_page_stats(), hash_page_type(), hash_range(), hash_range_extended(), hash_record(), hash_record_extended(), hash_scalar(), hash_search_with_hash_value(), hashbpchar(), hashbpcharextended(), hashtext(), hashtextextended(), hashvalidate(), heap_acquire_tuplock(), heap_beginscan(), heap_create(), heap_create_with_catalog(), heap_delete(), heap_fetch_toast_slice(), heap_force_common(), heap_form_minimal_tuple(), heap_form_tuple(), heap_getnext(), heap_inplace_lock(), heap_lock_tuple(), heap_page_fix_vm_corruption(), heap_page_items(), heap_pre_freeze_checks(), heap_prepare_freeze_tuple(), heap_prepare_insert(), heap_truncate_check_FKs(), heap_tuple_infomask_flags(), heap_update(), heapam_index_build_range_scan(), heapam_index_validate_scan(), heapam_tuple_lock(), hex_decode_safe_scalar(), hlparsetext(), HoldPinnedPortals(), hstore_from_array(), hstore_from_arrays(), hstore_populate_record(), hstore_recv(), hstore_subscript_assign(), hstore_subscript_transform(), hstore_to_plpython(), hstoreArrayToPairs(), hstoreCheckKeyLen(), hstoreCheckKeyLength(), hstoreCheckValLen(), hstoreCheckValLength(), i4tochar(), i4toi2(), i8tooid(), icu_language_tag(), icu_validate_locale(), identify_update_path(), import_expressions(), import_mcv(), import_pg_statistic(), ImportForeignSchema(), ImportSnapshot(), in_range_float4_float8(), in_range_float8_float8(), in_range_int2_int4(), in_range_int4_int4(), in_range_int4_int8(), in_range_int8_int8(), in_range_interval_interval(), in_range_numeric_numeric(), in_range_time_interval(), in_range_timestamp_interval(), in_range_timestamptz_interval(), in_range_timetz_interval(), inclusion_get_procinfo(), index_beginscan(), index_check_primary_key(), index_checkable(), index_constraint_create(), index_create(), index_create_copy(), index_delete_check_htid(), index_drop(), index_form_tuple_context(), index_opclass_options(), IndexOnlyNext(), inet_abbrev(), inet_merge(), inet_set_masklen(), inetand(), inetmi(), inetor(), infer_arbiter_indexes(), init_execution_state(), init_host_context(), init_MultiFuncCall(), init_params(), init_sexpr(), init_trgm_array(), initArrayResultArr(), InitControlFile(), InitFileAccess(), initGinState(), initialize_dh(), initialize_ecdh(), initialize_peragg(), InitializeClientEncoding(), InitializeMaxBackends(), InitializeSessionUserId(), InitLocalBuffers(), InitMaterializedSRF(), InitPgFdwOptions(), InitPostgres(), InitProcess(), InitShmemAllocator(), InitShmemIndexEntry(), InitTempTableNamespace(), initTrie(), InitWalRecovery(), InitXLogReaderState(), inner_subltree(), insert_property_record(), insert_property_records(), insert_username(), InsertRule(), instantiate_empty_record_variable(), int24div(), int24mi(), int24mul(), int24pl(), int28div(), int28mi(), int28mul(), int28pl(), int2_dist(), int2abs(), int2div(), int2mi(), int2mod(), int2mul(), int2pl(), int2um(), int2vectorin(), int2vectorrecv(), int42div(), int42mi(), int42mul(), int42pl(), int48div(), int48mi(), int48mul(), int48pl(), int4_cash(), int4_dist(), int4abs(), int4div(), int4gcd_internal(), int4inc(), int4lcm(), int4mi(), int4mod(), int4mul(), int4pl(), int4range_canonical(), int4um(), int82(), int82div(), int82mi(), int82mul(), int82pl(), int84(), int84div(), int84mi(), int84mul(), int84pl(), int8_cash(), int8_dist(), int8abs(), int8dec(), int8div(), int8gcd_internal(), int8inc(), int8lcm(), int8mi(), int8mod(), int8mul(), int8pl(), int8range_canonical(), int8um(), internal_get_result_type(), internal_inetpl(), internal_load_library(), interpret_AS_clause(), interpret_func_parallel(), interpret_func_support(), interpret_function_parameter_list(), interval_avg(), interval_div(), interval_in(), interval_justify_days(), interval_justify_hours(), interval_justify_interval(), interval_mi(), interval_mul(), interval_part_common(), interval_pl(), interval_sum(), interval_time(), interval_trunc(), interval_um_internal(), intervaltypmodin(), intorel_startup(), inv_open(), inv_read(), inv_seek(), inv_truncate(), inv_write(), iso8859_to_utf8(), issue_xlog_fsync(), IsThereCollationInNamespace(), IsThereFunctionInNamespace(), IsThereOpClassInNamespace(), IsThereOpFamilyInNamespace(), json_agg_transfn_worker(), json_build_object_worker(), json_errsave_error(), json_object(), json_object_agg_transfn_worker(), json_object_two_arg(), json_validate(), jsonb_agg_transfn_worker(), jsonb_array_length(), jsonb_build_object_worker(), jsonb_delete(), jsonb_delete_array(), jsonb_delete_idx(), jsonb_delete_path(), jsonb_insert(), jsonb_object(), jsonb_object_agg_transfn_worker(), jsonb_object_keys(), jsonb_object_two_arg(), jsonb_path_match_internal(), jsonb_set(), jsonb_set_lax(), jsonb_subscript_check_subscripts(), jsonb_subscript_transform(), JsonEncodeDateTime(), JsonItemFromDatum(), jsonpath_yyerror(), jsonPathFromCstring(), JsonPathQuery(), JsonPathValue(), JsValueToJsObject(), LargeObjectDrop(), lastval(), length_in_encoding(), libpqrcv_alter_slot(), libpqrcv_check_conninfo(), libpqrcv_connect(), libpqrcv_create_slot(), libpqrcv_endstreaming(), libpqrcv_exec(), libpqrcv_get_conninfo(), libpqrcv_get_option_from_conninfo(), libpqrcv_identify_system(), libpqrcv_processTuples(), libpqrcv_readtimelinehistoryfile(), libpqrcv_receive(), libpqrcv_send(), libpqrcv_startstreaming(), libpqsrv_connect_prepare(), libpqsrv_PQwrap(), like_fixed_prefix_ci(), line_construct_pp(), line_decode(), line_in(), line_recv(), ln_var(), lo_get_fragment_internal(), lo_read(), lo_truncate_internal(), lo_write(), load_categories_hash(), load_critical_index(), load_dh_file(), load_enum_cache_data(), load_external_function(), load_hba(), load_libraries(), LoadArchiveLibrary(), LoadPublications(), LocalToUtf(), locate_stem_module(), lock_twophase_recover(), LockAcquireExtended(), LockGXact(), LockSchemaList(), LockTableRecurse(), LockViewRecurse_walker(), LogicalParallelApplyLoop(), logicalrep_rel_mark_updatable(), logicalrep_rel_open(), logicalrep_report_missing_or_gen_attrs(), logicalrep_worker_attach(), logicalrep_worker_launch(), LogicalRepApplyLoop(), LogicalRepSyncSequences(), LogicalRepSyncTableStart(), lookup_agg_function(), lookup_am_handler_func(), lookup_fdw_connection_func(), lookup_fdw_handler_func(), lookup_rowtype_tupdesc_domain(), lookup_rowtype_tupdesc_internal(), lookup_type_cache(), LookupFuncName(), LookupFuncWithArgs(), LookupOperName(), LookupTypeNameExtended(), LookupTypeNameOid(), lpad(), lt_q_regex(), ltree_concat(), ltree_gist_in(), ltree_gist_out(), ltree_gist_relopts_validator(), ltree_to_plpython(), ltxtq_out(), ltxtq_send(), LWLockNewTrancheId(), lz4_decompress_datum(), lz4_decompress_datum_slice(), macaddr8_in(), macaddr8tomacaddr(), macaddr_in(), make_absolute_path(), make_callstmt_target(), make_date(), make_distinct_op(), make_expanded_record_from_tupdesc(), make_expanded_record_from_typeid(), make_inh_translation_list(), make_interval(), make_libc_collator(), make_modifytable(), make_op(), make_outerjoininfo(), make_pathkeys_for_window(), make_result_safe(), make_row_comparison_op(), make_row_distinct_op(), make_ruledef(), make_scalar_array_op(), make_time(), make_timestamp_internal(), make_timestamptz_at_timezone(), make_tsvector(), makeMultirangeTypeName(), makepol(), makepol(), makepol(), makeRangeVarFromNameList(), makeWholeRowVar(), map_sql_value_to_xml_value(), MarkAsPreparing(), MarkGUCPrefixReserved(), MarkInheritDetached(), MarkPortalActive(), matchLocks(), MatchText(), materializeResult(), md5_bytea(), md5_text(), md_readv_report(), mdextend(), mdreadv(), mdzeroextend(), MemoryContextAllocationFailure(), merge_acl_with_grant(), merge_collation_state(), merge_publications(), MergeAttributes(), MergeAttributesIntoExisting(), MergeCheckConstraint(), MergeChildAttribute(), MergeConstraintsIntoExisting(), MergeInheritedAttribute(), MergeWithExistingConstraint(), metaphone(), minmax_multi_get_procinfo(), moddatetime(), movedb(), mul_size(), multirange_constructor2(), multirange_in(), namerecv(), NamespaceCreate(), ndistinct_array_element_start(), ndistinct_array_end(), ndistinct_array_start(), ndistinct_object_end(), ndistinct_object_field_start(), ndistinct_object_start(), ndistinct_scalar(), network_host(), network_in(), network_out(), network_recv(), network_show(), NextCopyFromRawFieldsInternal(), nextval_internal(), NIAddAffix(), NIImportAffixes(), NIImportDictionary(), NIImportOOAffixes(), NISortDictionary(), NonFiniteIntervalPart(), NonFiniteTimestampTzPart(), normal_rand(), NUM_processor(), NUMDesc_prepare(), numeric_div_safe(), numeric_div_trunc(), numeric_fac(), numeric_in(), numeric_int2(), numeric_int4_safe(), numeric_int8_safe(), numeric_ln(), numeric_log(), numeric_mod_safe(), numeric_pg_lsn(), numeric_power(), numeric_recv(), numeric_sqrt(), numerictypmodin(), numericvar_to_double_no_overflow(), oauth_exchange(), oauth_init(), ObjectsInPublicationToOids(), oidvectorrecv(), okeys_array_start(), okeys_scalar(), on_proc_exit(), on_shmem_exit(), OnConflict_CheckForSerializationFailure(), op_error(), OpClassCacheLookup(), OpenPipeStream(), OpenTableList(), OpenTransientFilePerm(), OperatorCreate(), OperatorShellMake(), OperatorUpd(), OperatorValidateParams(), OpFamilyCacheLookup(), optionListToArray(), pa_send_data(), pa_wait_for_xact_finish(), page_checksum_internal(), page_header(), PageAddItemExtended(), PageGetItemIdCareful(), PageGetItemIdCareful(), PageIndexMultiDelete(), PageIndexTupleDelete(), PageIndexTupleDeleteNoCompact(), PageIndexTupleOverwrite(), PageIsVerified(), PageRepairFragmentation(), pair_decode(), palloc_btree_page(), ParallelApplyWorkerMain(), ParallelWorkerMain(), ParameterAclLookup(), parse_affentry(), parse_and_validate_value(), parse_basebackup_options(), parse_datetime(), parse_ddl_options(), parse_extension_control_file(), parse_fcall_arguments(), parse_format(), parse_hba_auth_opt(), parse_hba_line(), parse_hosts_line(), parse_ident(), parse_jsonb_index_flags(), parse_key_value_arrays(), parse_kvpairs_for_auth(), parse_lquery(), parse_ltree(), parse_one_reloption(), parse_output_parameters(), parse_phrase_operator(), parse_publication_options(), parse_re_flags(), parse_sane_timezone(), parse_snapshot(), parse_subscription_options(), parse_test_flags(), parse_tsquery(), parseCheckAggregates(), ParseConfigFile(), ParseConfigFp(), parseCreateReplSlotOptions(), ParseExplainOptionList(), ParseFuncOrColumn(), parseIntFromText(), parseNameAndArgTypes(), parseRelOptionsInternal(), parserOpenPropGraph(), parserOpenTable(), parsetext(), parseTypeString(), parseUnicode(), parseVxidFromText(), parseXidFromText(), partitioned_table_reloptions(), path_add(), path_decode(), path_in(), path_poly(), path_recv(), PathNameOpenFilePerm(), pclose_check(), percentile_cont_final_common(), percentile_disc_final(), perform_base_backup(), perform_default_encoding_conversion(), PerformCursorOpen(), PerformPortalClose(), PerformPortalFetch(), PerformWalRecovery(), pg_analyze_and_rewrite_varparams(), pg_any_to_server(), pg_attribute_aclcheck_all_ext(), pg_attribute_aclmask_ext(), pg_backup_start(), pg_backup_stop(), pg_base64_decode_internal(), pg_be_scram_build_secret(), pg_buffercache_evict_relation(), pg_buffercache_mark_dirty_relation(), pg_buffercache_superuser_check(), pg_cancel_backend(), pg_class_aclmask_ext(), pg_clear_attribute_stats(), pg_clear_extended_stats(), pg_collation_actual_version(), pg_collation_for(), pg_convert(), pg_create_restore_point(), pg_crypt(), pg_cryptohash_create(), pg_current_logfile(), pg_current_wal_flush_lsn(), pg_current_wal_insert_lsn(), pg_current_wal_lsn(), pg_database_collation_actual_version(), pg_database_size_oid(), pg_decode_startup(), pg_decrypt(), pg_decrypt_iv(), pg_dependencies_in(), pg_dependencies_recv(), pg_do_encoding_conversion(), pg_encrypt(), pg_encrypt_iv(), pg_error_on_null(), pg_event_trigger_ddl_commands(), pg_event_trigger_dropped_objects(), pg_event_trigger_table_rewrite_oid(), pg_event_trigger_table_rewrite_reason(), pg_extension_config_dump(), pg_freespace(), pg_gen_salt(), pg_gen_salt_rounds(), pg_get_advice_stash_contents(), pg_get_database_ddl_internal(), pg_get_expr_worker(), pg_get_functiondef(), pg_get_multixact_members(), pg_get_multixact_stats(), pg_get_object_address(), pg_get_propgraphdef(), pg_get_role_ddl_internal(), pg_get_serial_sequence(), pg_get_tablespace_ddl_internal(), pg_get_wal_record_info(), pg_get_wal_records_info_till_end_of_wal(), pg_get_wal_replay_pause_state(), pg_get_wal_stats_till_end_of_wal(), pg_hmac_create(), pg_import_system_collations(), pg_is_wal_replay_paused(), pg_largeobject_aclmask_snapshot(), pg_log_standby_snapshot(), pg_logical_slot_get_changes_guts(), pg_ls_replslotdir(), pg_ls_tmpdir(), pg_lsn_in_safe(), pg_lsn_mii(), pg_lsn_pli(), pg_mcv_list_in(), pg_mcv_list_recv(), pg_namespace_aclmask_ext(), pg_ndistinct_in(), pg_ndistinct_recv(), pg_nextoid(), pg_parameter_acl_aclmask(), pg_prewarm(), pg_promote(), pg_random_bytes(), pg_read_binary_file_common(), pg_read_file_common(), pg_regerror(), pg_relpages(), pg_relpages_impl(), pg_relpagesbyid(), pg_replication_origin_create(), pg_replication_origin_session_progress(), pg_replication_origin_xact_setup(), pg_replication_slot_advance(), pg_sequence_parameters(), pg_set_regex_collation(), pg_set_stashed_advice(), pg_size_bytes(), pg_snapshot_recv(), pg_split_walfile_name(), pg_start_stash_advice_worker(), pg_stat_get_progress_info(), pg_stat_reset_shared(), pg_stat_reset_subscription_stats(), pg_stat_statements_info(), pg_stat_statements_internal(), pg_stats_ext_mcvlist_items(), pg_stop_making_pinned_objects(), pg_strtoint16_safe(), pg_strtoint32_safe(), pg_strtoint64_safe(), pg_switch_wal(), pg_sync_replication_slots(), pg_tablespace_size_oid(), pg_terminate_backend(), pg_to_ascii(), pg_type_aclmask_ext(), pg_unicode_to_server(), pg_visibility(), pg_visibility_map(), pg_wait_until_termination(), pg_wal_replay_pause(), pg_wal_replay_resume(), pg_wal_summary_contents(), pg_walfile_name(), pg_walfile_name_offset(), pgfdw_cancel_query_begin(), pgfdw_cancel_query_end(), pgfdw_reject_incomplete_xact_state_change(), pgfdw_report_internal(), pgfdw_security_check(), pgfdw_xact_callback(), PGLC_localeconv(), pglz_decompress_datum(), pglz_decompress_datum_slice(), pgoutput_column_list_init(), pgoutput_startup(), pgrowlocks(), pgsa_check_lockout(), pgsa_check_stash_name(), pgsa_clear_advice_string(), pgsa_create_stash(), pgsa_drop_stash(), pgsa_read_from_disk(), pgsa_set_advice_string(), pgsa_start_worker(), pgsa_unescape_tsv_field(), PGSharedMemoryCreate(), pgss_shmem_init(), pgstat_get_entry_ref(), pgstat_get_kind_from_str(), pgstat_heap(), pgstat_init_function_usage(), pgstat_relation(), pgstat_reset_replslot(), pgstatginindex(), pgstatginindex_internal(), pgstathashindex(), pgstatindex(), pgstatindex_impl(), pgstatindexbyid(), pgstattuple(), pgstattuple_approx(), pgstattuple_approx_internal(), pgstattuplebyid(), pipe_read_line(), placeChar(), plan_recursive_revoke(), plperl_array_to_datum(), plperl_build_tuple_result(), plperl_call_perl_event_trigger_func(), plperl_call_perl_func(), plperl_call_perl_trigger_func(), plperl_create_sub(), plperl_func_handler(), plperl_init_interp(), plperl_modify_tuple(), plperl_return_next_internal(), plperl_spi_execute_fetch_result(), plperl_sv_to_datum(), plperl_sv_to_literal(), plperl_to_hstore(), plperl_trigger_handler(), plperl_trusted_init(), plperl_untrusted_init(), plperl_validator(), plpgsql_build_datatype_arrayof(), plpgsql_build_variable(), plpgsql_compile_callback(), plpgsql_exec_event_trigger(), plpgsql_exec_function(), plpgsql_exec_get_datum_type(), plpgsql_exec_get_datum_type_info(), plpgsql_exec_trigger(), plpgsql_param_eval_generic(), plpgsql_param_eval_generic_ro(), plpgsql_param_eval_recfield(), plpgsql_parse_cwordrowtype(), plpgsql_parse_cwordtype(), plpgsql_parse_err_condition(), plpgsql_parse_wordrowtype(), plpgsql_parse_wordtype(), plpgsql_post_column_ref(), plpgsql_recognize_err_condition(), plpgsql_validator(), plpgsql_yyerror(), plpython_to_hstore(), pltcl_build_tuple_result(), pltcl_elog(), pltcl_func_handler(), pltcl_trigger_handler(), PLy_cursor_fetch(), PLy_elog_impl(), PLy_exec_function(), PLy_exec_trigger(), PLy_modify_tuple(), PLy_output(), PLy_procedure_create(), PLy_spi_execute_fetch_result(), PLyGenericObject_ToComposite(), PLyMapping_ToComposite(), PLyNumber_ToJsonbValue(), PLyObject_AsString(), PLyObject_ToJsonbValue(), PLySequence_ToArray(), PLySequence_ToArray_recurse(), PLySequence_ToComposite(), PLyUnicode_ToComposite(), policy_role_list_to_array(), poly_in(), poly_recv(), populate_array_check_dimension(), populate_array_report_expected_array(), populate_joinrel_with_paths(), populate_recordset_array_element_start(), populate_recordset_object_start(), populate_recordset_scalar(), populate_recordset_worker(), PortalDrop(), PortalRunSelect(), PortalSetResultFormat(), postgres_fdw_validator(), postgresAcquireSampleRowsFunc(), postgresBeginForeignInsert(), postgresExecForeignTruncate(), postgresImportForeignSchema(), postgresImportForeignStatistics(), PostgresMain(), postgresql_fdw_validator(), PostgresSingleUserMain(), PostmasterMain(), PostPrepare_Locks(), power_var(), power_var_int(), pq_copymsgbytes(), pq_getmessage(), pq_getmsgbyte(), pq_getmsgbytes(), pq_getmsgend(), pq_getmsgrawstring(), pq_getmsgstring(), pq_getmsgtext(), pq_startmsgread(), PreCommit_CheckForSerializationFailure(), PreCommit_Notify(), PreCommit_Portals(), predicatelock_twophase_recover(), PrefetchBuffer(), prepare_cb_wrapper(), prepare_sql_fn_parse_info(), PrepareForIncrementalBackup(), PrepareQuery(), PrepareRedoAdd(), PrepareTransaction(), preprocess_grouping_sets(), prepTuplestoreResult(), PreventCommandDuringRecovery(), PreventCommandIfParallelMode(), PreventCommandIfReadOnly(), PreventInTransactionBlock(), printtup_prepare_info(), ProcArrayAdd(), ProcedureCreate(), process_function_rte_ref(), process_matched_tle(), process_owned_by(), process_postgres_switches(), process_single_relation(), ProcessAllDatabases(), ProcessCancelRequestPacket(), ProcessConfigFileInternal(), ProcessCopyOptions(), ProcessDatabase(), ProcessInterrupts(), ProcessParallelApplyMessage(), ProcessParallelApplyMessages(), ProcessParallelMessages(), ProcessPgArchInterrupts(), ProcessRepliesIfAny(), ProcessSlotSyncMessage(), ProcessSSLStartup(), ProcessStandbyMessage(), ProcessStartupPacket(), ProcessTwoPhaseBuffer(), processTypesSpec(), ProcessUtilitySlow(), propgraph_edge_get_ref_keys(), propgraph_element_get_key(), prsd_headline(), prseof(), prssyntaxerror(), prssyntaxerror(), pub_collist_validate(), publication_add_relation(), publication_add_schema(), PublicationDropSchemas(), PublicationDropTables(), pushquery(), PushTransaction(), pushval_asis(), pushValue(), pushValue_internal(), pvsnprintf(), px_crypt_des(), px_crypt_shacrypt(), px_THROW_ERROR(), qtext_load_file(), QTN2QT(), QualifiedNameGetCreationNamespace(), query_to_xml_internal(), queryin(), QueueCheckConstraintValidation(), QueueNNConstraintValidation(), quickdie(), random_numeric(), random_var(), range_constructor3(), range_minus_internal(), range_parse(), range_parse_bound(), range_parse_flags(), range_serialize(), range_union_internal(), RangeVarAdjustRelationPersistence(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForAttachIndex(), RangeVarCallbackForDropRelation(), RangeVarCallbackForLockTable(), RangeVarCallbackForPolicy(), RangeVarCallbackForReindexIndex(), RangeVarCallbackForRenameRule(), RangeVarCallbackForRenameTrigger(), RangeVarCallbackForStats(), RangeVarCallbackMaintainsTable(), RangeVarCallbackOwnsRelation(), RangeVarGetAndCheckCreationNamespace(), RangeVarGetCreationNamespace(), RangeVarGetRelidExtended(), raw_heap_insert(), RE_compile(), RE_compile_and_cache(), RE_wchar_execute(), read_any_attr(), read_attr_value(), read_backup_label(), read_binary_file(), read_client_final_message(), read_client_first_message(), read_dictionary(), read_objtype_from_string(), read_relmap_file(), read_tablespace_map(), read_whole_file(), ReadArrayBinary(), ReadArrayDimensions(), ReadArrayStr(), ReadArrayToken(), ReadBufferExtended(), ReadControlFile(), ReadDimensionInt(), readRecoverySignalFile(), ReadReplicationSlot(), readstoplist(), ReadTwoPhaseFile(), ReassignOwnedObjects(), ReceiveCopyBinaryHeader(), recompute_limits(), record_cmp(), record_eq(), record_image_cmp(), record_image_eq(), record_in(), record_recv(), recordDependencyOnCurrentExtension(), RecoveryRequiresIntParameter(), recursive_revoke(), recv_password_packet(), refresh_by_match_merge(), RefreshMatViewByOid(), refuseDupeIndexAttach(), regclassin(), regcollationin(), regcomp_auth_token(), regconfigin(), regdatabasein(), regdictionaryin(), regex_fixed_prefix(), regexp_count(), regexp_fixed_prefix(), regexp_instr(), regexp_like(), regexp_match(), regexp_split_to_array(), regexp_split_to_table(), regexp_substr(), RegisterBackgroundWorker(), RegisterExtensibleNodeEntry(), RegisterTimeout(), regnamespacein(), regoperatorin(), regoperin(), regprocedurein(), regprocin(), REGRESS_exec_check_perms(), REGRESS_object_access_hook(), REGRESS_object_access_hook_str(), REGRESS_utility_command(), regrolein(), reindex_index(), reindex_relation(), ReindexMultipleTables(), ReindexRelationConcurrently(), reject_target_detail(), relation_statistics_update(), RelationBuildPartitionKey(), RelationCacheInitializePhase3(), RelationCopyStorage(), RelationGetBufferForTuple(), RelationSetNewRelfilenumber(), ReleaseOneSerializableXact(), ReleaseSavepoint(), RememberAllDependentForRebuilding(), remove_tablespace_symlink(), RemoveExtensionById(), RemoveInheritance(), RemoveObjects(), RemovePolicyById(), RemoveRelations(), RemoveRewriteRuleById(), RemoveSubscriptionRel(), RemoveTriggerById(), RemoveUserMapping(), rename_constraint_internal(), rename_policy(), renameatt_check(), renameatt_internal(), RenameConstraintById(), RenameDatabase(), RenameEnumLabel(), RenameRelationInternal(), RenameRewriteRule(), RenameRole(), RenameSchema(), RenameTableSpace(), renametrig(), renametrig_internal(), RenameType(), RenameTypeInternal(), repack_startup(), RepackWorkerMain(), repeat(), replace_percent_placeholders(), replace_property_refs_mutator(), replace_text_regexp(), ReplaceVarFromTargetList(), replication_yyerror(), ReplicationSlotAcquire(), ReplicationSlotAlter(), ReplicationSlotCreate(), ReplicationSlotDrop(), ReplicationSlotDropAtPubNode(), ReplicationSlotsDropDBSlots(), ReplicationSlotValidateName(), replorigin_advance(), replorigin_by_name(), replorigin_by_oid(), replorigin_check_prerequisites(), replorigin_create(), replorigin_session_reset(), replorigin_session_setup(), replorigin_state_clear(), ReplSlotSyncWorkerMain(), report_invalid_encoding_int(), report_name_conflict(), report_namespace_conflict(), report_newlocale_failure(), report_recovery_conflict(), report_sequence_errors(), report_untranslatable_char(), reportDependentObjects(), ReportNotNullViolationError(), ReportSlotConnectionError(), ReportWalSummaryError(), RequestNamedLWLockTranche(), reserveAllocatedDesc(), resolve_anyarray_from_others(), resolve_anyelement_from_others(), resolve_anymultirange_from_others(), resolve_anyrange_from_others(), resolve_column_ref(), resolve_unique_index_expr(), ResolveOpClass(), restore_tuple(), RestoreGUCState(), RestoreSlotFromDisk(), restrict_and_check_grant(), revalidate_rectypeid(), RevalidateCachedQuery(), revmap_physical_extend(), RewriteQuery(), rewriteRuleAction(), rewriteSearchAndCycle(), rewriteTargetListIU(), rewriteTargetView(), ri_CheckTrigger(), ri_FetchConstraintInfo(), RI_FKey_check(), RI_Initial_Check(), ri_LockPKTuple(), ri_PerformCheck(), ri_ReportViolation(), rollback_prepared_cb_wrapper(), RollbackToSavepoint(), rpad(), run_apply_worker(), sanity_check_array(), sanity_check_tid_array(), SanityCheckBackgroundWorker(), satisfies_hash_partition(), scanNameSpaceForRefname(), scanNameSpaceForRelid(), scanner_yyerror(), scanNSItemForColumn(), scanRTEForColumn(), scram_exchange(), scram_init(), secure_open_gssapi(), secure_read(), secure_write(), seg_yyerror(), select_best_grantor(), select_common_collation(), select_common_type(), select_common_type_from_oids(), select_perl_context(), SendBaseBackup(), sendDir(), SendFunctionResult(), SendTimeLineHistory(), sepgsql_attribute_relabel(), sepgsql_avc_check_perms_label(), sepgsql_avc_init(), sepgsql_avc_unlabeled(), sepgsql_client_auth(), sepgsql_compute_avd(), sepgsql_compute_create(), sepgsql_get_label(), sepgsql_init_client_label(), sepgsql_mcstrans_in(), sepgsql_mcstrans_out(), sepgsql_object_relabel(), sepgsql_relation_relabel(), sepgsql_restorecon(), sepgsql_set_client_label(), sepgsql_utility_command(), serialize_expr_stats(), serialize_prepare_info(), server_check_detail(), set_config_by_name(), set_config_with_handle(), set_max_safe_fds(), set_var_from_non_decimal_integer_str(), set_var_from_str(), setCompoundAffixFlagValue(), SetDefaultACL(), setPath(), setPathArray(), setPathObject(), SetPossibleUnsafeConflict(), SetRWConflict(), setseed(), SetSequence(), SetSerializableTransactionSnapshot(), setTargetTable(), SetTransactionSnapshot(), setup_background_workers(), setup_dynamic_shared_memory(), setup_pct_info(), setup_regexp_matches(), setup_test_matches(), SetUserIdAndContext(), SharedFileSetAttach(), shdepDropOwned(), shdepLockAndCheckObject(), shdepReassignOwned(), shell_check_detail(), shell_finish_command(), shell_get_sink(), shell_in(), shell_out(), shm_mq_receive(), shm_mq_sendv(), shm_toc_allocate(), shm_toc_insert(), ShmemAlloc(), should_apply_changes_for_rel(), should_refetch_tuple(), similar_escape_internal(), SlabContextCreate(), slot_modify_data(), slot_store_data(), slotsync_reread_config(), SnapBuildInitialSnapshot(), SnapBuildRestoreContents(), SnapBuildRestoreSnapshot(), socket_set_nonblocking(), SocketBackend(), sort(), spgadjustmembers(), spgdoinsert(), spgFormInnerTuple(), spgFormNodeTuple(), spgGetCache(), spgvalidate(), SPI_cursor_open_internal(), split_part(), SplitPartitionMoveRows(), sql_compile_callback(), sql_postrewrite_callback(), sqrt_var(), ssl_extension_info(), standard_ProcessUtility(), StandbySlotsHaveCaughtup(), start_repack_decoding_worker(), StartBackgroundWorker(), StartChildProcess(), StartDataChecksumsWorkerLauncher(), StartReplication(), StartupDecodingContext(), StartupReplicationOrigin(), StartupXLOG(), statatt_build_stavalues(), statatt_get_type(), statext_dependencies_validate(), statext_mcv_import(), statext_ndistinct_validate(), stats_check_arg_array(), stats_check_arg_pair(), stats_check_required_arg(), stop_repack_decoding_worker(), storeOperators(), StorePreparedStatement(), storeProcedures(), StoreRelCheck(), storeRow(), str_casefold(), str_initcap(), str_tolower(), str_toupper(), str_udeescape(), stream_abort_cb_wrapper(), stream_change_cb_wrapper(), stream_commit_cb_wrapper(), stream_prepare_cb_wrapper(), stream_start_cb_wrapper(), stream_stop_cb_wrapper(), string2ean(), string_to_privilege(), string_to_uuid(), stringToQualifiedNameList(), strlower_libc_mb(), strtitle_libc_mb(), strupper_libc_mb(), substitute_grouped_columns_mutator(), substitute_path_macro(), SummarizeWAL(), suppress_redundant_updates_trigger(), SV_to_JsonbValue(), SwitchToUntrustedUser(), synchronize_one_slot(), SyncRepWaitForLSN(), systable_beginscan_ordered(), systable_inplace_update_begin(), system_beginsamplescan(), system_rows_beginsamplescan(), system_time_beginsamplescan(), table_tuple_get_latest_tid(), tablesample_init(), TablespaceCreateDbspace(), TargetPrivilegesCheck(), tblspc_redo(), TerminateOtherDBBackends(), test_custom_stats_var_create(), test_enc_conversion(), test_re_compile(), test_re_execute(), test_shm_mq(), test_shm_mq_main(), test_shm_mq_pipelined(), text_format(), text_format_append_string(), text_format_parse_digits(), text_format_parse_format(), text_format_string_conversion(), text_overlay(), text_starts_with(), text_substring(), text_to_bits(), textarray_to_strvaluelist(), textregexreplace(), textregexreplace_extended(), textToQualifiedNameList(), tfuncInitialize(), tfuncLoadRows(), thesaurus_init(), thesaurusRead(), throw_tcl_error(), tidin(), time_mi_interval(), time_part_common(), time_pl_interval(), time_recv(), timestamp2date_safe(), timestamp2timestamptz_safe(), timestamp_age(), timestamp_bin(), timestamp_in(), timestamp_izone(), timestamp_mi(), timestamp_out(), timestamp_part_common(), timestamp_pl_interval(), timestamp_random(), timestamp_recv(), timestamp_time(), timestamp_to_char(), timestamp_trunc(), timestamp_zone(), timestamptz2date_safe(), timestamptz2timestamp_safe(), timestamptz_age(), timestamptz_bin(), timestamptz_in(), timestamptz_izone(), timestamptz_out(), timestamptz_part_common(), timestamptz_pl_interval_internal(), timestamptz_random(), timestamptz_recv(), timestamptz_time(), timestamptz_timetz(), timestamptz_to_char(), timestamptz_trunc_internal(), timestamptz_zone(), timetz_izone(), timetz_mi_interval(), timetz_part_common(), timetz_pl_interval(), timetz_recv(), timetz_zone(), to_ascii_enc(), to_ascii_encname(), to_date(), to_json(), to_jsonb(), to_timestamp(), TopologicalSort(), tqueueReceiveSlot(), TransactionIdGetCommitTsData(), TransactionIdInRecentPast(), TransactionIdIsInProgress(), transformAExprNullIf(), transformAggregateCall(), transformAlterTableStmt(), transformArrayExpr(), transformAssignedExpr(), transformAssignmentIndirection(), transformAssignmentSubscripts(), transformCaseExpr(), transformCoalesceExpr(), transformCollateClause(), transformColumnDefinition(), transformColumnNameList(), transformColumnRef(), transformColumnType(), transformConstraintAttrs(), transformContainerSubscripts(), transformCreateStmt(), transformCreateTableAsStmt(), transformDeclareCursorStmt(), transformDeleteStmt(), transformDistinctClause(), transformDistinctOnClause(), transformExprRecurse(), transformFkeyCheckAttrs(), transformFkeyGetPrimaryKey(), transformForPortionOfClause(), transformFrameOffset(), transformFromClauseItem(), transformGenericOptions(), transformGraphElementPattern(), transformGraphTablePropertyRef(), transformGroupingFunc(), transformGroupingSet(), TransformGUCArray(), transformIndexConstraint(), transformIndexStmt(), transformIndirection(), transformInsertRow(), transformInsertStmt(), transformJsonAggConstructor(), transformJsonArrayQueryConstructor(), transformJsonBehavior(), transformJsonFuncExpr(), transformJsonIsPredicate(), transformJsonOutput(), transformJsonParseArg(), transformJsonParseExpr(), transformJsonReturning(), transformJsonSerializeExpr(), transformJsonTable(), transformJsonTableColumns(), transformJsonValueExpr(), transformLabelExpr(), transformLimitClause(), transformLockingClause(), transformMergeStmt(), transformMergeSupportFunc(), transformMultiAssignRef(), transformOnConflictArbiter(), transformParamRef(), transformPartitionBound(), transformPartitionBoundValue(), transformPartitionCmd(), transformPartitionCmdForMerge(), transformPartitionCmdForSplit(), transformPartitionRangeBounds(), transformPartitionSpec(), transformPathPatternList(), transformPathTerm(), transformPLAssignStmtTarget(), TransformPubWhereClauses(), transformRangeFunction(), transformRangeGraphTable(), transformRangeTableFunc(), transformRangeTableSample(), transformRelOptions(), transformReturningClause(), transformRowExpr(), transformRuleStmt(), transformSelectStmt(), transformSetOperationStmt(), transformSetOperationTree(), transformStatsStmt(), transformSubLink(), transformTableConstraint(), transformTableLikeClause(), transformTypeCast(), transformUpdateStmt(), transformUpdateTargetList(), transformValuesClause(), transformWindowDefinitions(), transformWindowFuncCall(), transformWithClause(), transformXmlExpr(), transformXmlSerialize(), translate(), triggered_change_notification(), trim_array(), truncate_check_activity(), truncate_check_rel(), truncate_identifier(), tryAttachPartitionForeignKey(), ts_headline_byid_opt(), ts_headline_json_byid_opt(), ts_headline_jsonb_byid_opt(), ts_stat_sql(), tsquery_phrase_distance(), tsquery_rewrite_query(), tsvector_concat(), tsvector_filter(), tsvector_update_trigger(), tsvectorin(), tts_buffer_heap_getsysattr(), tts_buffer_is_current_xact_tuple(), tts_heap_getsysattr(), tts_heap_is_current_xact_tuple(), tts_minimal_getsysattr(), tts_minimal_is_current_xact_tuple(), tts_virtual_getsysattr(), tts_virtual_is_current_xact_tuple(), tuple_data_split(), tuple_data_split_internal(), tupledesc_match(), tuples_equal(), tuplesort_begin_index_gin(), TwoPhaseTransactionGid(), TypeCreate(), TypeGetTupleDesc(), typenameType(), typenameTypeMod(), TypeShellMake(), typeStringToTypeName(), uint32in_subr(), uint64in_subr(), unaccent_dict(), unaccent_init(), unicode_norm_form_from_string(), unique_key_recheck(), uniqueifyJsonbObject(), unistr(), unknown_attribute(), update_local_synced_slot(), UserAbortTransactionBlock(), utf8_to_iso8859(), utf8_to_win(), UtfToLocal(), uuid_generate_internal(), vac_update_relstats(), vacuum(), vacuum_open_relation(), validate(), validate_ddl_tags(), validate_kvpair(), validate_option_array_item(), validate_pkattnums(), validate_relation_as_index(), validate_relation_as_sequence(), validate_relation_as_table(), validate_remote_info(), validate_table_rewrite_tags(), validate_token_format(), validate_va_cols_list(), validateConnectbyTupleDesc(), validateDomainCheckConstraint(), validateDomainNotNullConstraint(), validateFkOnDeleteSetColumns(), validateInfiniteBounds(), ValidateInputLSNs(), ValidateJoinEstimator(), ValidateOperatorReference(), ValidatePgVersion(), validateRecoveryParameters(), ValidateRestrictionEstimator(), ValidateSlotSyncParams(), varbit(), varbit_in(), varbit_recv(), varchar(), varchar_input(), variable_coerce_param_hook(), variable_paramref_hook(), varstr_levenshtein(), verify_brin_page(), verify_cb(), verify_dictoptions(), verify_gist_page(), verify_hash_page(), verify_heapam(), verifyBackupPageConsistency(), verifyNotNullPKCompatible(), verifyPartitionIndexNotNull(), VirtualXactLock(), wait_for_workers_to_become_ready(), WaitEventCustomNew(), WaitForAllTransactionsToFinish(), WaitForLSN(), WaitForParallelWorkersToAttach(), WaitForParallelWorkersToExit(), WaitForParallelWorkersToFinish(), WaitForWalSummarization(), WalRcvFetchTimeLineHistoryFiles(), WALReadRaiseError(), WalReceiverMain(), widget_in(), width_bucket_array(), width_bucket_float8(), width_bucket_numeric(), win_to_utf8(), WinCheckAndInitializeNullTreatment(), window_nth_value(), window_ntile(), worker_spi_launch(), write_auto_conf_file(), X509_NAME_field_to_text(), X509_NAME_to_cstring(), XLogFileCopy(), XLogPageRead(), XLogReadBufferForRedoExtended(), XlogReadTwoPhaseData(), XLogWalRcvProcessMsg(), xml_out_internal(), xmlcomment(), xmlpi(), XmlTableGetValue(), XmlTableSetColumnFilter(), XmlTableSetNamespace(), XmlTableSetRowFilter(), xmltotext_with_options(), xmlvalidate(), xpath_table(), and xslt_process().

◆ errcode_for_file_access()

int errcode_for_file_access ( void  )

Definition at line 898 of file elog.c.

899{
901
902 /* we don't bother incrementing recursion_depth */
904
905 switch (edata->saved_errno)
906 {
907 /* Permission-denied failures */
908 case EPERM: /* Not super-user */
909 case EACCES: /* Permission denied */
910#ifdef EROFS
911 case EROFS: /* Read only file system */
912#endif
914 break;
915
916 /* File not found */
917 case ENOENT: /* No such file or directory */
918 edata->sqlerrcode = ERRCODE_UNDEFINED_FILE;
919 break;
920
921 /* Duplicate file */
922 case EEXIST: /* File exists */
923 edata->sqlerrcode = ERRCODE_DUPLICATE_FILE;
924 break;
925
926 /* Wrong object type or state */
927 case ENOTDIR: /* Not a directory */
928 case EISDIR: /* Is a directory */
929#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
930 case ENOTEMPTY: /* Directory not empty */
931#endif
932 edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE;
933 break;
934
935 /* Insufficient resources */
936 case ENOSPC: /* No space left on device */
937 edata->sqlerrcode = ERRCODE_DISK_FULL;
938 break;
939
940 case ENOMEM: /* Out of memory */
941 edata->sqlerrcode = ERRCODE_OUT_OF_MEMORY;
942 break;
943
944 case ENFILE: /* File table overflow */
945 case EMFILE: /* Too many open files */
947 break;
948
949 /* Hardware failure */
950 case EIO: /* I/O error */
951 edata->sqlerrcode = ERRCODE_IO_ERROR;
952 break;
953
954 case ENAMETOOLONG: /* File name too long */
955 edata->sqlerrcode = ERRCODE_FILE_NAME_TOO_LONG;
956 break;
957
958 /* All else is classified as internal errors */
959 default:
960 edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
961 break;
962 }
963
964 return 0; /* return value does not matter */
965}

References CHECK_STACK_DEPTH, errordata, errordata_stack_depth, and fb().

Referenced by _mdfd_getseg(), _mdnblocks(), AddToDataDirLockFile(), AlterSystemSetConfigFile(), ApplyLogicalMappingFile(), apw_dump_now(), apw_load_buffers(), assign_wal_sync_method(), basebackup_read_file(), basic_archive_file(), bbsink_server_archive_contents(), bbsink_server_begin_archive(), bbsink_server_begin_manifest(), bbsink_server_end_archive(), bbsink_server_manifest_contents(), bbsink_server_new(), be_lo_export(), BeginCopyFrom(), BeginCopyTo(), BootStrapXLOG(), BufFileDumpBuffer(), BufFileLoadBuffer(), BufFileOpenFileSet(), BufFileReadCommon(), BufFileSeek(), BufFileSize(), BufFileTruncateFileSet(), calculate_relation_size(), calculate_tablespace_size(), ChangeToDataDir(), check_ssl_key_file_permissions(), checkDataDir(), CheckPointLogicalRewriteHeap(), CheckPointReplicationOrigin(), CheckPointSnapBuild(), CheckXLogRemoved(), clone_file(), ClosePipeFromProgram(), ClosePipeToProgram(), ClosePostmasterPorts(), compare_files(), copy_file(), copydir(), CopyGetData(), CopySendEndOfRow(), create_tablespace_directories(), CreateDirAndVersionFile(), CreateLockFile(), CreateOptsFile(), CreateSlotOnDisk(), db_dir_size(), DebugFileOpen(), DeleteAllExportedSnapshotFiles(), destroy_tablespace_directories(), do_pg_backup_stop(), do_truncate(), dsm_cleanup_for_mmap(), dsm_impl_mmap(), durable_rename(), durable_unlink(), EndCopy(), EndCopyFrom(), entry_reset(), errcode_for_dynamic_shared_memory(), ExecHashJoinNewBatch(), existsTimeLineHistory(), ExportSnapshot(), fileAnalyzeForeignTable(), FileClose(), fsync_fname_ext(), gc_qtexts(), get_controlfile_by_exact_path(), get_dirent_type(), get_tablespace_location(), GetConfFilesInDir(), getInstallationPaths(), hashagg_batch_read(), heap_xlog_logical_rewrite(), ImportSnapshot(), InitPostgres(), InitPostmasterDeathWatchHandle(), InitWalRecovery(), internal_load_library(), issue_xlog_fsync(), KeepFileRestoredFromArchive(), lo_import_internal(), load_dh_file(), logfile_open(), logical_end_heap_rewrite(), logical_heap_rewrite_flush_mappings(), logical_rewrite_log_mapping(), ltsReadBlock(), ltsWriteBlock(), md_readv_report(), mdcreate(), mdextend(), mdimmedsync(), mdopenfork(), mdreadv(), mdstartreadv(), mdtruncate(), mdunlinkfork(), mdwritev(), mdzeroextend(), normalize_exec_path(), open_auth_file(), OpenWalSummaryFile(), parse_extension_control_file(), ParseConfigFile(), PathNameCreateTemporaryDir(), PathNameCreateTemporaryFile(), PathNameDeleteTemporaryFile(), PathNameOpenTemporaryFile(), perform_base_backup(), pg_current_logfile(), pg_file_exists(), pg_flush_data(), pg_import_system_collations(), pg_ls_dir_files(), pg_promote(), pg_stat_file(), pg_tablespace_databases(), pg_tzenumerate_next(), pg_tzenumerate_start(), pgarch_archiveDone(), pgarch_readyXlog(), pgsa_read_from_disk(), pgsa_write_error(), pgsa_write_to_disk(), PGSemaphoreInit(), PGSharedMemoryCreate(), pgss_shmem_init(), pgss_shmem_shutdown(), pgstat_discard_stats(), pgstat_read_statsfile(), pgstat_write_statsfile(), pipe_read_line(), PostmasterMain(), PrepareRedoAdd(), ProcessSyncRequests(), qtext_load_file(), qtext_store(), read_backup_label(), read_binary_file(), read_relmap_file(), read_tablespace_map(), read_whole_file(), ReadControlFile(), ReadDirExtended(), ReadNextXLogRecord(), readRecoverySignalFile(), readTimeLineHistory(), ReadTwoPhaseFile(), ReadWalSummary(), RecheckDataDirLockFile(), RecreateTwoPhaseFile(), register_dirty_segment(), remove_tablespace_symlink(), RemovePgTempFilesInDir(), RemovePgTempRelationFilesInDbspace(), RemoveTwoPhaseFile(), RemoveWalSummaryIfOlderThan(), RemoveXlogFile(), ReorderBufferCleanupSerializedTXNs(), ReorderBufferRestoreChanges(), ReorderBufferRestoreCleanup(), ReorderBufferSerializeChange(), ReorderBufferSerializeTXN(), ReplicationSlotDropPtr(), ResetUnloggedRelationsInDbspaceDir(), ResetUnloggedRelationsInTablespaceDir(), RestoreArchivedFile(), RestoreSlotFromDisk(), run_ssl_passphrase_command(), SaveSlotToPath(), SendBackupManifest(), sendDir(), sendFile(), sendTablespace(), SendTimeLineHistory(), Setup_AF_UNIX(), shell_finish_command(), shell_run_command(), shell_send_data(), SlruReportIOError(), SnapBuildRestoreContents(), SnapBuildRestoreSnapshot(), SnapBuildSerialize(), SnapBuildSnapshotExists(), StartupReplicationOrigin(), sts_parallel_scan_next(), sts_read_tuple(), SummarizeWAL(), SyncDataDirectory(), SyncPostCheckpoint(), SysLogger_Start(), TablespaceCreateDbspace(), test_custom_stats_var_finish(), test_custom_stats_var_from_serialized_data(), test_custom_stats_var_to_serialized_data(), tokenize_auth_file(), tuplestore_copy_read_pointer(), tuplestore_gettuple(), tuplestore_puttuple_common(), tuplestore_rescan(), tuplestore_select_read_pointer(), unlink_if_exists_fname(), unlink_initfile(), update_controlfile(), update_metainfo_datafile(), ValidatePgVersion(), ValidateXLOGDirectoryStructure(), wal_segment_open(), WALReadRaiseError(), WalReceiverMain(), WalSndSegmentOpen(), write_auto_conf_file(), write_item(), write_relcache_init_file(), write_relmap_file(), WriteControlFile(), writeTimeLineHistory(), writeTimeLineHistoryFile(), WriteWalSummary(), XLogArchiveForceDone(), XLogArchiveNotify(), XLogFileClose(), XLogFileCopy(), XLogFileInit(), XLogFileInitInternal(), XLogFileOpen(), XLogFileRead(), XLogFileReadAnyTLI(), XLogInitNewTimeline(), XLogPageRead(), XlogReadTwoPhaseData(), XLogWalRcvClose(), XLogWalRcvWrite(), and XLogWrite().

◆ errcode_for_socket_access()

int errcode_for_socket_access ( void  )

Definition at line 977 of file elog.c.

978{
980
981 /* we don't bother incrementing recursion_depth */
983
984 switch (edata->saved_errno)
985 {
986 /* Loss of connection */
988 edata->sqlerrcode = ERRCODE_CONNECTION_FAILURE;
989 break;
990
991 /* All else is classified as internal errors */
992 default:
993 edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
994 break;
995 }
996
997 return 0; /* return value does not matter */
998}
#define ALL_CONNECTION_FAILURE_ERRNOS
Definition port.h:122

References ALL_CONNECTION_FAILURE_ERRNOS, CHECK_STACK_DEPTH, errordata, errordata_stack_depth, and fb().

Referenced by AcceptConnection(), auth_peer(), be_tls_open_server(), ident_inet(), InitPostmasterChild(), InitPostmasterDeathWatchHandle(), internal_flush_buffer(), ListenServerPort(), pq_getbyte_if_available(), pq_recvbuf(), ProcessStartupPacket(), SysLogger_Start(), SysLoggerMain(), and WaitEventSetWaitBlock().

◆ errfinish()

void errfinish ( const char filename,
int  lineno,
const char funcname 
)

Definition at line 486 of file elog.c.

487{
489 int elevel;
490 MemoryContext oldcontext;
491 ErrorContextCallback *econtext;
492
495
496 /* Save the last few bits of error state into the stack entry */
498
499 elevel = edata->elevel;
500
501 /*
502 * Do processing in ErrorContext, which we hope has enough reserved space
503 * to report an error.
504 */
506
507 /* Collect backtrace, if enabled and we didn't already */
508 if (!edata->backtrace &&
509 edata->funcname &&
513
514 /*
515 * Call any context callback functions. Errors occurring in callback
516 * functions will be treated as recursive errors --- this ensures we will
517 * avoid infinite recursion (see errstart).
518 */
519 for (econtext = error_context_stack;
520 econtext != NULL;
521 econtext = econtext->previous)
522 econtext->callback(econtext->arg);
523
524 /*
525 * If ERROR (not more nor less) we pass it off to the current handler.
526 * Printing it and popping the stack is the responsibility of the handler.
527 */
528 if (elevel == ERROR)
529 {
530 /*
531 * We do some minimal cleanup before longjmp'ing so that handlers can
532 * execute in a reasonably sane state.
533 *
534 * Reset InterruptHoldoffCount in case we ereport'd from inside an
535 * interrupt holdoff section. (We assume here that no handler will
536 * itself be inside a holdoff section. If necessary, such a handler
537 * could save and restore InterruptHoldoffCount for itself, but this
538 * should make life easier for most.)
539 */
542
543 CritSectionCount = 0; /* should be unnecessary, but... */
544
545 /*
546 * Note that we leave CurrentMemoryContext set to ErrorContext. The
547 * handler should reset it to something else soon.
548 */
549
551 PG_RE_THROW();
552 }
553
554 /* Emit the message to the right places */
556
557 /*
558 * If this is the outermost recursion level, we can clean up by resetting
559 * ErrorContext altogether (compare FlushErrorState), which is good
560 * because it cleans up any random leakages that might have occurred in
561 * places such as context callback functions. If we're nested, we can
562 * only safely remove the subsidiary data of the current stack entry.
563 */
564 if (errordata_stack_depth == 0 && recursion_depth == 1)
566 else
568
569 /* Release stack entry and exit error-handling context */
571 MemoryContextSwitchTo(oldcontext);
573
574 /*
575 * Perform error recovery action as specified by elevel.
576 */
577 if (elevel == FATAL || elevel == FATAL_CLIENT_ONLY)
578 {
579 /*
580 * For a FATAL error, we let proc_exit clean up and exit.
581 *
582 * If we just reported a startup failure, the client will disconnect
583 * on receiving it, so don't send any more to the client.
584 */
587
588 /*
589 * fflush here is just to improve the odds that we get to see the
590 * error message, in case things are so hosed that proc_exit crashes.
591 * Any other code you might be tempted to add here should probably be
592 * in an on_proc_exit or on_shmem_exit callback instead.
593 */
594 fflush(NULL);
595
596 /*
597 * Let the cumulative stats system know. Only mark the session as
598 * terminated by fatal error if there is no other known cause.
599 */
602
603 /*
604 * Do normal process-exit cleanup, then return exit code 1 to indicate
605 * FATAL termination. The postmaster may or may not consider this
606 * worthy of panic, depending on which subprocess returns it.
607 */
608 proc_exit(1);
609 }
610
611 if (elevel >= PANIC)
612 {
613 /*
614 * Serious crash time. Postmaster will observe SIGABRT process exit
615 * status and kill the other backends too.
616 *
617 * XXX: what if we are *in* the postmaster? abort() won't kill our
618 * children...
619 */
620 fflush(NULL);
621 abort();
622 }
623
624 /*
625 * Check for cancel/die interrupt first --- this is so that the user can
626 * stop a query emitting tons of notice or warning messages, even if it's
627 * in a loop that otherwise fails to check for interrupts.
628 */
630}
@ DestRemote
Definition dest.h:89
@ DestNone
Definition dest.h:87
void EmitErrorReport(void)
Definition elog.c:1883
static void FreeErrorDataContents(ErrorData *edata)
Definition elog.c:2026
ErrorContextCallback * error_context_stack
Definition elog.c:100
static bool matches_backtrace_functions(const char *funcname)
Definition elog.c:847
static void set_stack_entry_location(ErrorData *edata, const char *filename, int lineno, const char *funcname)
Definition elog.c:817
sigjmp_buf * PG_exception_stack
Definition elog.c:102
#define PG_RE_THROW()
Definition elog.h:407
#define PANIC
Definition elog.h:44
#define FATAL_CLIENT_ONLY
Definition elog.h:43
volatile uint32 QueryCancelHoldoffCount
Definition globals.c:44
volatile uint32 InterruptHoldoffCount
Definition globals.c:43
volatile uint32 CritSectionCount
Definition globals.c:45
char * backtrace_functions
Definition guc_tables.c:576
#define funcname
void proc_exit(int code)
Definition ipc.c:105
void MemoryContextReset(MemoryContext context)
Definition mcxt.c:403
#define CHECK_FOR_INTERRUPTS()
Definition miscadmin.h:125
static char * filename
Definition pg_dumpall.c:133
@ DISCONNECT_FATAL
Definition pgstat.h:63
@ DISCONNECT_NORMAL
Definition pgstat.h:61
SessionEndType pgStatSessionEndCause
CommandDest whereToSendOutput
Definition postgres.c:97
struct ErrorContextCallback * previous
Definition elog.h:299
void(* callback)(void *arg)
Definition elog.h:300

References ErrorContextCallback::arg, backtrace_functions, ErrorContextCallback::callback, CHECK_FOR_INTERRUPTS, CHECK_STACK_DEPTH, CritSectionCount, DestNone, DestRemote, DISCONNECT_FATAL, DISCONNECT_NORMAL, EmitErrorReport(), ERROR, error_context_stack, ErrorContext, errordata, errordata_stack_depth, FATAL, FATAL_CLIENT_ONLY, fb(), filename, FreeErrorDataContents(), funcname, InterruptHoldoffCount, matches_backtrace_functions(), MemoryContextReset(), MemoryContextSwitchTo(), PANIC, PG_exception_stack, PG_RE_THROW, pgStatSessionEndCause, ErrorContextCallback::previous, proc_exit(), QueryCancelHoldoffCount, recursion_depth, set_backtrace(), set_stack_entry_location(), and whereToSendOutput.

Referenced by errsave_finish(), pg_re_throw(), and ThrowErrorData().

◆ errmsg()

int errmsg ( const char fmt,
  ... 
)

Definition at line 1094 of file elog.c.

1095{
1097 MemoryContext oldcontext;
1098
1101 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1102
1103 edata->message_id = fmt;
1104 EVALUATE_MESSAGE(edata->domain, message, false, true);
1105
1106 MemoryContextSwitchTo(oldcontext);
1108 return 0; /* return value does not matter */
1109}
#define EVALUATE_MESSAGE(domain, targetfield, appendval, translateit)
Definition elog.c:1013

References CHECK_STACK_DEPTH, errordata, errordata_stack_depth, EVALUATE_MESSAGE, fb(), MemoryContextSwitchTo(), and recursion_depth.

◆ error_severity()

const char * error_severity ( int  elevel)

Definition at line 4157 of file elog.c.

4158{
4159 const char *prefix;
4160
4161 switch (elevel)
4162 {
4163 case DEBUG1:
4164 case DEBUG2:
4165 case DEBUG3:
4166 case DEBUG4:
4167 case DEBUG5:
4168 prefix = gettext_noop("DEBUG");
4169 break;
4170 case LOG:
4171 case LOG_SERVER_ONLY:
4172 prefix = gettext_noop("LOG");
4173 break;
4174 case INFO:
4175 prefix = gettext_noop("INFO");
4176 break;
4177 case NOTICE:
4178 prefix = gettext_noop("NOTICE");
4179 break;
4180 case WARNING:
4182 prefix = gettext_noop("WARNING");
4183 break;
4184 case ERROR:
4185 prefix = gettext_noop("ERROR");
4186 break;
4187 case FATAL:
4188 case FATAL_CLIENT_ONLY:
4189 prefix = gettext_noop("FATAL");
4190 break;
4191 case PANIC:
4192 prefix = gettext_noop("PANIC");
4193 break;
4194 default:
4195 prefix = "???";
4196 break;
4197 }
4198
4199 return prefix;
4200}
#define gettext_noop(x)
Definition c.h:1285
#define DEBUG3
Definition elog.h:29
#define LOG_SERVER_ONLY
Definition elog.h:33
#define WARNING_CLIENT_ONLY
Definition elog.h:39
#define WARNING
Definition elog.h:37
#define DEBUG2
Definition elog.h:30
#define DEBUG1
Definition elog.h:31
#define NOTICE
Definition elog.h:36
#define INFO
Definition elog.h:35
#define DEBUG5
Definition elog.h:27
#define DEBUG4
Definition elog.h:28

References DEBUG1, DEBUG2, DEBUG3, DEBUG4, DEBUG5, ERROR, FATAL, FATAL_CLIENT_ONLY, gettext_noop, INFO, LOG, LOG_SERVER_ONLY, NOTICE, PANIC, WARNING, and WARNING_CLIENT_ONLY.

Referenced by send_message_to_frontend(), send_message_to_server_log(), write_csvlog(), and write_jsonlog().

◆ errsave_finish()

void errsave_finish ( struct Node context,
const char filename,
int  lineno,
const char funcname 
)

Definition at line 703 of file elog.c.

705{
706 ErrorSaveContext *escontext = (ErrorSaveContext *) context;
708
709 /* verify stack depth before accessing *edata */
711
712 /*
713 * If errsave_start punted to errstart, then elevel will be ERROR or
714 * perhaps even PANIC. Punt likewise to errfinish.
715 */
716 if (edata->elevel >= ERROR)
717 {
718 errfinish(filename, lineno, funcname);
720 }
721
722 /*
723 * Else, we should package up the stack entry contents and deliver them to
724 * the caller.
725 */
727
728 /* Save the last few bits of error state into the stack entry */
730
731 /* Replace the LOG value that errsave_start inserted */
732 edata->elevel = ERROR;
733
734 /*
735 * We skip calling backtrace and context functions, which are more likely
736 * to cause trouble than provide useful context; they might act on the
737 * assumption that a transaction abort is about to occur.
738 */
739
740 /*
741 * Make a copy of the error info for the caller. All the subsidiary
742 * strings are already in the caller's context, so it's sufficient to
743 * flat-copy the stack entry.
744 */
745 escontext->error_data = palloc_object(ErrorData);
746 memcpy(escontext->error_data, edata, sizeof(ErrorData));
747
748 /* Exit error-handling context */
751}
#define pg_unreachable()
Definition c.h:367
void errfinish(const char *filename, int lineno, const char *funcname)
Definition elog.c:486
ErrorData * error_data
Definition miscnodes.h:49

References CHECK_STACK_DEPTH, errfinish(), ERROR, ErrorSaveContext::error_data, errordata, errordata_stack_depth, fb(), filename, funcname, memcpy(), palloc_object, pg_unreachable, recursion_depth, and set_stack_entry_location().

◆ errsave_start()

bool errsave_start ( struct Node context,
const char domain 
)

Definition at line 651 of file elog.c.

652{
653 ErrorSaveContext *escontext;
655
656 /*
657 * Do we have a context for soft error reporting? If not, just punt to
658 * errstart().
659 */
660 if (context == NULL || !IsA(context, ErrorSaveContext))
661 return errstart(ERROR, domain);
662
663 /* Report that a soft error was detected */
664 escontext = (ErrorSaveContext *) context;
665 escontext->error_occurred = true;
666
667 /* Nothing else to do if caller wants no further details */
668 if (!escontext->details_wanted)
669 return false;
670
671 /*
672 * Okay, crank up a stack entry to store the info in.
673 */
674
676
677 /* Initialize data for this error frame */
679 edata->elevel = LOG; /* signal all is well to errsave_finish */
681 /* Select default errcode based on the assumed elevel of ERROR */
682 edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
683
684 /*
685 * Any allocations for this error state level should go into the caller's
686 * context. We don't need to pollute ErrorContext, or even require it to
687 * exist, in this code path.
688 */
689 edata->assoc_context = CurrentMemoryContext;
690
692 return true;
693}
bool errstart(int elevel, const char *domain)
Definition elog.c:355
static ErrorData * get_error_stack_entry(void)
Definition elog.c:773
static void set_stack_entry_domain(ErrorData *edata, const char *domain)
Definition elog.c:800
#define IsA(nodeptr, _type_)
Definition nodes.h:164

References CurrentMemoryContext, ErrorSaveContext::details_wanted, ERROR, ErrorSaveContext::error_occurred, errstart(), fb(), get_error_stack_entry(), IsA, LOG, recursion_depth, and set_stack_entry_domain().

◆ errstart()

bool errstart ( int  elevel,
const char domain 
)

Definition at line 355 of file elog.c.

356{
358 bool output_to_server;
359 bool output_to_client = false;
360 int i;
361
362 /*
363 * Check some cases in which we want to promote an error into a more
364 * severe error. None of this logic applies for non-error messages.
365 */
366 if (elevel >= ERROR)
367 {
368 /*
369 * If we are inside a critical section, all errors become PANIC
370 * errors. See miscadmin.h.
371 */
372 if (CritSectionCount > 0)
373 elevel = PANIC;
374
375 /*
376 * Check reasons for treating ERROR as FATAL:
377 *
378 * 1. we have no handler to pass the error to (implies we are in the
379 * postmaster or in backend startup).
380 *
381 * 2. ExitOnAnyError mode switch is set (initdb uses this).
382 *
383 * 3. the error occurred after proc_exit has begun to run. (It's
384 * proc_exit's responsibility to see that this doesn't turn into
385 * infinite recursion!)
386 */
387 if (elevel == ERROR)
388 {
389 if (PG_exception_stack == NULL ||
392 elevel = FATAL;
393 }
394
395 /*
396 * If the error level is ERROR or more, errfinish is not going to
397 * return to caller; therefore, if there is any stacked error already
398 * in progress it will be lost. This is more or less okay, except we
399 * do not want to have a FATAL or PANIC error downgraded because the
400 * reporting process was interrupted by a lower-grade error. So check
401 * the stack and make sure we panic if panic is warranted.
402 */
403 for (i = 0; i <= errordata_stack_depth; i++)
404 elevel = Max(elevel, errordata[i].elevel);
405 }
406
407 /*
408 * Now decide whether we need to process this report at all; if it's
409 * warning or less and not enabled for logging, just return false without
410 * starting up any error logging machinery.
411 */
412 output_to_server = should_output_to_server(elevel);
413 output_to_client = should_output_to_client(elevel);
414 if (elevel < ERROR && !output_to_server && !output_to_client)
415 return false;
416
417 /*
418 * We need to do some actual work. Make sure that memory context
419 * initialization has finished, else we can't do anything useful.
420 */
421 if (ErrorContext == NULL)
422 {
423 /* Oops, hard crash time; very little we can do safely here */
424 write_stderr("error occurred before error message processing is available\n");
425 exit(2);
426 }
427
428 /*
429 * Okay, crank up a stack entry to store the info in.
430 */
431
432 if (recursion_depth++ > 0 && elevel >= ERROR)
433 {
434 /*
435 * Oops, error during error processing. Clear ErrorContext as
436 * discussed at top of file. We will not return to the original
437 * error's reporter or handler, so we don't need it.
438 */
440
441 /*
442 * Infinite error recursion might be due to something broken in a
443 * context traceback routine. Abandon them too. We also abandon
444 * attempting to print the error statement (which, if long, could
445 * itself be the source of the recursive failure).
446 */
448 {
451 }
452 }
453
454 /* Initialize data for this error frame */
456 edata->elevel = elevel;
457 edata->output_to_server = output_to_server;
458 edata->output_to_client = output_to_client;
460 /* Select default errcode based on elevel */
461 if (elevel >= ERROR)
462 edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
463 else if (elevel >= WARNING)
464 edata->sqlerrcode = ERRCODE_WARNING;
465 else
467
468 /*
469 * Any allocations for this error state level should go into ErrorContext
470 */
471 edata->assoc_context = ErrorContext;
472
474 return true;
475}
#define write_stderr(str)
Definition parallel.c:186
#define Max(x, y)
Definition c.h:1085
static bool should_output_to_client(int elevel)
Definition elog.c:257
static bool should_output_to_server(int elevel)
Definition elog.c:248
bool ExitOnAnyError
Definition globals.c:125
bool proc_exit_inprogress
Definition ipc.c:41

References CritSectionCount, debug_query_string, ERROR, error_context_stack, ErrorContext, errordata, errordata_stack_depth, ExitOnAnyError, FATAL, fb(), get_error_stack_entry(), i, in_error_recursion_trouble(), Max, MemoryContextReset(), PANIC, PG_exception_stack, proc_exit_inprogress, recursion_depth, set_stack_entry_domain(), should_output_to_client(), should_output_to_server(), WARNING, and write_stderr.

Referenced by errsave_start(), errstart_cold(), and ThrowErrorData().

◆ errstart_cold()

pg_attribute_cold bool errstart_cold ( int  elevel,
const char domain 
)

Definition at line 339 of file elog.c.

340{
341 return errstart(elevel, domain);
342}

References errstart().

◆ FlushErrorState()

◆ format_elog_string()

char * format_elog_string ( const char fmt,
  ... 
)

Definition at line 1850 of file elog.c.

1851{
1854 MemoryContext oldcontext;
1855
1856 /* Initialize a mostly-dummy error frame */
1857 edata = &errdata;
1858 MemSet(edata, 0, sizeof(ErrorData));
1859 /* the default text domain is the backend's */
1860 edata->domain = save_format_domain ? save_format_domain : PG_TEXTDOMAIN("postgres");
1861 /* set the errno to be used to interpret %m */
1862 edata->saved_errno = save_format_errnumber;
1863
1864 oldcontext = MemoryContextSwitchTo(ErrorContext);
1865
1866 edata->message_id = fmt;
1867 EVALUATE_MESSAGE(edata->domain, message, false, true);
1868
1869 MemoryContextSwitchTo(oldcontext);
1870
1871 return edata->message;
1872}
#define PG_TEXTDOMAIN(domain)
Definition c.h:1303
#define MemSet(start, val, len)
Definition c.h:1107
static const char * save_format_domain
Definition elog.c:1838

References ErrorContext, EVALUATE_MESSAGE, fb(), MemoryContextSwitchTo(), MemSet, PG_TEXTDOMAIN, and save_format_domain.

◆ FreeErrorData()

◆ FreeErrorDataContents()

static void FreeErrorDataContents ( ErrorData edata)
static

Definition at line 2026 of file elog.c.

2027{
2028 if (edata->message)
2029 pfree(edata->message);
2030 if (edata->detail)
2031 pfree(edata->detail);
2032 if (edata->detail_log)
2033 pfree(edata->detail_log);
2034 if (edata->hint)
2035 pfree(edata->hint);
2036 if (edata->context)
2037 pfree(edata->context);
2038 if (edata->backtrace)
2039 pfree(edata->backtrace);
2040 if (edata->schema_name)
2041 pfree(edata->schema_name);
2042 if (edata->table_name)
2043 pfree(edata->table_name);
2044 if (edata->column_name)
2045 pfree(edata->column_name);
2046 if (edata->datatype_name)
2047 pfree(edata->datatype_name);
2048 if (edata->constraint_name)
2049 pfree(edata->constraint_name);
2050 if (edata->internalquery)
2051 pfree(edata->internalquery);
2052}

References fb(), and pfree().

Referenced by errfinish(), and FreeErrorData().

◆ get_backend_type_for_log()

const char * get_backend_type_for_log ( void  )

Definition at line 3203 of file elog.c.

3204{
3205 const char *backend_type_str;
3206
3207 if (MyProcPid == PostmasterPid)
3208 backend_type_str = "postmaster";
3209 else if (MyBackendType == B_BG_WORKER)
3210 {
3211 if (MyBgworkerEntry)
3213 else
3214 backend_type_str = "early bgworker";
3215 }
3216 else
3218
3219 return backend_type_str;
3220}
pid_t PostmasterPid
Definition globals.c:108
int MyProcPid
Definition globals.c:49
@ B_BG_WORKER
Definition miscadmin.h:358
const char * GetBackendTypeDesc(BackendType backendType)
Definition miscinit.c:264
BackendType MyBackendType
Definition miscinit.c:65
BackgroundWorker * MyBgworkerEntry
Definition postmaster.c:201
char bgw_type[BGW_MAXLEN]
Definition bgworker.h:99

References B_BG_WORKER, BackgroundWorker::bgw_type, fb(), GetBackendTypeDesc(), MyBackendType, MyBgworkerEntry, MyProcPid, and PostmasterPid.

Referenced by log_status_format(), write_csvlog(), and write_jsonlog().

◆ get_error_stack_entry()

static ErrorData * get_error_stack_entry ( void  )
static

Definition at line 773 of file elog.c.

774{
776
777 /* Allocate error frame */
780 {
781 /* Wups, stack not big enough */
782 errordata_stack_depth = -1; /* make room on stack */
783 ereport(PANIC, (errmsg_internal("ERRORDATA_STACK_SIZE exceeded")));
784 }
785
786 /* Initialize error frame to all zeroes/NULLs */
788 memset(edata, 0, sizeof(ErrorData));
789
790 /* Save errno immediately to ensure error parameter eval can't change it */
791 edata->saved_errno = errno;
792
793 return edata;
794}
#define unlikely(x)
Definition c.h:438
#define ERRORDATA_STACK_SIZE
Definition elog.c:154

References ereport, errmsg_internal(), errordata, errordata_stack_depth, ERRORDATA_STACK_SIZE, fb(), PANIC, and unlikely.

Referenced by errsave_start(), errstart(), GetErrorContextStack(), and ReThrowError().

◆ get_formatted_log_time()

char * get_formatted_log_time ( void  )

Definition at line 3106 of file elog.c.

3107{
3109 char msbuf[13];
3110
3111 /* leave if already computed */
3112 if (formatted_log_time[0] != '\0')
3113 return formatted_log_time;
3114
3115 if (!saved_timeval_set)
3116 {
3118 saved_timeval_set = true;
3119 }
3120
3122
3123 /*
3124 * Note: we expect that guc.c will ensure that log_timezone is set up (at
3125 * least with a minimal GMT value) before Log_line_prefix can become
3126 * nonempty or CSV/JSON mode can be selected.
3127 */
3129 /* leave room for milliseconds... */
3130 "%Y-%m-%d %H:%M:%S %Z",
3132
3133 /* 'paste' milliseconds into place... */
3134 sprintf(msbuf, ".%03d", (int) (saved_timeval.tv_usec / 1000));
3136
3137 return formatted_log_time;
3138}
#define FORMATTED_TS_LEN
Definition elog.c:169
static struct timeval saved_timeval
Definition elog.c:166
int64 pg_time_t
Definition pgtime.h:23
size_t pg_strftime(char *s, size_t maxsize, const char *format, const struct pg_tm *t)
Definition strftime.c:128
struct pg_tm * pg_localtime(const pg_time_t *timep, const pg_tz *tz)
Definition localtime.c:1345
PGDLLIMPORT pg_tz * log_timezone
Definition pgtz.c:31
#define sprintf
Definition port.h:262
int gettimeofday(struct timeval *tp, void *tzp)

References fb(), formatted_log_time, FORMATTED_TS_LEN, gettimeofday(), log_timezone, memcpy(), pg_localtime(), pg_strftime(), saved_timeval, saved_timeval_set, and sprintf.

Referenced by log_status_format(), write_csvlog(), and write_jsonlog().

◆ get_formatted_start_time()

char * get_formatted_start_time ( void  )

Definition at line 3156 of file elog.c.

3157{
3159
3160 /* leave if already computed */
3161 if (formatted_start_time[0] != '\0')
3162 return formatted_start_time;
3163
3164 /*
3165 * Note: we expect that guc.c will ensure that log_timezone is set up (at
3166 * least with a minimal GMT value) before Log_line_prefix can become
3167 * nonempty or CSV/JSON mode can be selected.
3168 */
3170 "%Y-%m-%d %H:%M:%S %Z",
3172
3173 return formatted_start_time;
3174}
static char formatted_start_time[FORMATTED_TS_LEN]
Definition elog.c:170
pg_time_t MyStartTime
Definition globals.c:50

References fb(), formatted_start_time, FORMATTED_TS_LEN, log_timezone, MyStartTime, pg_localtime(), and pg_strftime().

Referenced by log_status_format(), write_csvlog(), and write_jsonlog().

◆ GetErrorContextStack()

char * GetErrorContextStack ( void  )

Definition at line 2255 of file elog.c.

2256{
2258 ErrorContextCallback *econtext;
2259
2260 /*
2261 * Crank up a stack entry to store the info in.
2262 */
2264
2266
2267 /*
2268 * Set up assoc_context to be the caller's context, so any allocations
2269 * done (which will include edata->context) will use their context.
2270 */
2271 edata->assoc_context = CurrentMemoryContext;
2272
2273 /*
2274 * Call any context callback functions to collect the context information
2275 * into edata->context.
2276 *
2277 * Errors occurring in callback functions should go through the regular
2278 * error handling code which should handle any recursive errors, though we
2279 * double-check above, just in case.
2280 */
2281 for (econtext = error_context_stack;
2282 econtext != NULL;
2283 econtext = econtext->previous)
2284 econtext->callback(econtext->arg);
2285
2286 /*
2287 * Clean ourselves off the stack, any allocations done should have been
2288 * using edata->assoc_context, which we set up earlier to be the caller's
2289 * context, so we're free to just remove our entry off the stack and
2290 * decrement recursion depth and exit.
2291 */
2294
2295 /*
2296 * Return a pointer to the string the caller asked for, which should have
2297 * been allocated in their context.
2298 */
2299 return edata->context;
2300}

References ErrorContextCallback::arg, ErrorContextCallback::callback, CurrentMemoryContext, error_context_stack, errordata_stack_depth, fb(), get_error_stack_entry(), ErrorContextCallback::previous, and recursion_depth.

Referenced by exec_stmt_getdiag().

◆ in_error_recursion_trouble()

bool in_error_recursion_trouble ( void  )

Definition at line 306 of file elog.c.

307{
308 /* Pull the plug if recurse more than once */
309 return (recursion_depth > 2);
310}

References recursion_depth.

Referenced by err_gettext(), err_sendstring(), errstart(), pgfdw_abort_cleanup(), pgfdw_abort_cleanup_begin(), and write_console().

◆ is_log_level_output()

static bool is_log_level_output ( int  elevel,
int  log_min_level 
)
inlinestatic

Definition at line 214 of file elog.c.

215{
216 if (elevel == LOG || elevel == LOG_SERVER_ONLY)
217 {
219 return true;
220 }
221 else if (elevel == WARNING_CLIENT_ONLY || elevel == FATAL_CLIENT_ONLY)
222 {
223 /* never sent to log, regardless of log_min_level */
224 return false;
225 }
226 else if (log_min_level == LOG)
227 {
228 /* elevel != LOG */
229 if (elevel >= FATAL)
230 return true;
231 }
232 /* Neither is LOG */
233 else if (elevel >= log_min_level)
234 return true;
235
236 return false;
237}

References ERROR, FATAL, FATAL_CLIENT_ONLY, fb(), LOG, LOG_SERVER_ONLY, and WARNING_CLIENT_ONLY.

Referenced by check_log_of_query(), and should_output_to_server().

◆ log_line_prefix()

static void log_line_prefix ( StringInfo  buf,
ErrorData edata 
)
static

Definition at line 3261 of file elog.c.

3262{
3264}
void log_status_format(StringInfo buf, const char *format, ErrorData *edata)
Definition elog.c:3270
char * Log_line_prefix
Definition elog.c:115

References buf, fb(), Log_line_prefix, and log_status_format().

Referenced by send_message_to_server_log().

◆ log_min_messages_cmp()

static int log_min_messages_cmp ( const ListCell a,
const ListCell b 
)
static

Definition at line 2574 of file elog.c.

2575{
2576 const char *s = lfirst(a);
2577 const char *t = lfirst(b);
2578
2579 if (strchr(s, ':') == NULL)
2580 return -1;
2581 else if (strchr(t, ':') == NULL)
2582 return 1;
2583 else
2584 return strcmp(s, t);
2585}
int b
Definition isn.c:74
int a
Definition isn.c:73

References a, b, fb(), and lfirst.

Referenced by check_log_min_messages().

◆ log_status_format()

void log_status_format ( StringInfo  buf,
const char format,
ErrorData edata 
)

Definition at line 3270 of file elog.c.

3271{
3272 /* static counter for line numbers */
3273 static long log_line_number = 0;
3274
3275 /* has counter been reset in current process? */
3276 static int log_my_pid = 0;
3277 int padding;
3278 const char *p;
3279
3280 /*
3281 * This is one of the few places where we'd rather not inherit a static
3282 * variable's value from the postmaster. But since we will, reset it when
3283 * MyProcPid changes. MyStartTime also changes when MyProcPid does, so
3284 * reset the formatted start timestamp too.
3285 */
3286 if (log_my_pid != MyProcPid)
3287 {
3288 log_line_number = 0;
3291 }
3293
3294 if (format == NULL)
3295 return; /* in case guc hasn't run yet */
3296
3297 for (p = format; *p != '\0'; p++)
3298 {
3299 if (*p != '%')
3300 {
3301 /* literal char, just copy */
3303 continue;
3304 }
3305
3306 /* must be a '%', so skip to the next char */
3307 p++;
3308 if (*p == '\0')
3309 break; /* format error - ignore it */
3310 else if (*p == '%')
3311 {
3312 /* string contains %% */
3314 continue;
3315 }
3316
3317
3318 /*
3319 * Process any formatting which may exist after the '%'. Note that
3320 * process_log_prefix_padding moves p past the padding number if it
3321 * exists.
3322 *
3323 * Note: Since only '-', '0' to '9' are valid formatting characters we
3324 * can do a quick check here to pre-check for formatting. If the char
3325 * is not formatting then we can skip a useless function call.
3326 *
3327 * Further note: At least on some platforms, passing %*s rather than
3328 * %s to appendStringInfo() is substantially slower, so many of the
3329 * cases below avoid doing that unless non-zero padding is in fact
3330 * specified.
3331 */
3332 if (*p > '9')
3333 padding = 0;
3334 else if ((p = process_log_prefix_padding(p, &padding)) == NULL)
3335 break;
3336
3337 /* process the option */
3338 switch (*p)
3339 {
3340 case 'a':
3341 if (MyProcPort)
3342 {
3343 const char *appname = application_name;
3344
3345 if (appname == NULL || *appname == '\0')
3346 appname = _("[unknown]");
3347 if (padding != 0)
3348 appendStringInfo(buf, "%*s", padding, appname);
3349 else
3350 appendStringInfoString(buf, appname);
3351 }
3352 else if (padding != 0)
3354 padding > 0 ? padding : -padding);
3355
3356 break;
3357 case 'b':
3358 {
3360
3361 if (padding != 0)
3362 appendStringInfo(buf, "%*s", padding, backend_type_str);
3363 else
3365 break;
3366 }
3367 case 'u':
3368 if (MyProcPort)
3369 {
3370 const char *username = MyProcPort->user_name;
3371
3372 if (username == NULL || *username == '\0')
3373 username = _("[unknown]");
3374 if (padding != 0)
3375 appendStringInfo(buf, "%*s", padding, username);
3376 else
3378 }
3379 else if (padding != 0)
3381 padding > 0 ? padding : -padding);
3382 break;
3383 case 'd':
3384 if (MyProcPort)
3385 {
3386 const char *dbname = MyProcPort->database_name;
3387
3388 if (dbname == NULL || *dbname == '\0')
3389 dbname = _("[unknown]");
3390 if (padding != 0)
3391 appendStringInfo(buf, "%*s", padding, dbname);
3392 else
3394 }
3395 else if (padding != 0)
3397 padding > 0 ? padding : -padding);
3398 break;
3399 case 'c':
3400 if (padding != 0)
3401 {
3402 char strfbuf[128];
3403
3404 snprintf(strfbuf, sizeof(strfbuf) - 1, "%" PRIx64 ".%x",
3406 appendStringInfo(buf, "%*s", padding, strfbuf);
3407 }
3408 else
3410 break;
3411 case 'p':
3412 if (padding != 0)
3413 appendStringInfo(buf, "%*d", padding, MyProcPid);
3414 else
3416 break;
3417
3418 case 'P':
3419 if (MyProc)
3420 {
3421 PGPROC *leader = MyProc->lockGroupLeader;
3422
3423 /*
3424 * Show the leader only for active parallel workers. This
3425 * leaves out the leader of a parallel group.
3426 */
3427 if (leader == NULL || leader->pid == MyProcPid)
3429 padding > 0 ? padding : -padding);
3430 else if (padding != 0)
3431 appendStringInfo(buf, "%*d", padding, leader->pid);
3432 else
3433 appendStringInfo(buf, "%d", leader->pid);
3434 }
3435 else if (padding != 0)
3437 padding > 0 ? padding : -padding);
3438 break;
3439
3440 case 'l':
3441 if (padding != 0)
3442 appendStringInfo(buf, "%*ld", padding, log_line_number);
3443 else
3445 break;
3446 case 'm':
3447 /* force a log timestamp reset */
3448 formatted_log_time[0] = '\0';
3450
3451 if (padding != 0)
3452 appendStringInfo(buf, "%*s", padding, formatted_log_time);
3453 else
3455 break;
3456 case 't':
3457 {
3459 char strfbuf[128];
3460
3461 pg_strftime(strfbuf, sizeof(strfbuf),
3462 "%Y-%m-%d %H:%M:%S %Z",
3464 if (padding != 0)
3465 appendStringInfo(buf, "%*s", padding, strfbuf);
3466 else
3468 }
3469 break;
3470 case 'n':
3471 {
3472 char strfbuf[128];
3473
3474 if (!saved_timeval_set)
3475 {
3477 saved_timeval_set = true;
3478 }
3479
3480 snprintf(strfbuf, sizeof(strfbuf), "%ld.%03d",
3481 (long) saved_timeval.tv_sec,
3482 (int) (saved_timeval.tv_usec / 1000));
3483
3484 if (padding != 0)
3485 appendStringInfo(buf, "%*s", padding, strfbuf);
3486 else
3488 }
3489 break;
3490 case 's':
3491 {
3493
3494 if (padding != 0)
3495 appendStringInfo(buf, "%*s", padding, start_time);
3496 else
3498 }
3499 break;
3500 case 'i':
3501 if (MyProcPort)
3502 {
3503 const char *psdisp;
3504 int displen;
3505
3507 if (padding != 0)
3508 appendStringInfo(buf, "%*s", padding, psdisp);
3509 else
3511 }
3512 else if (padding != 0)
3514 padding > 0 ? padding : -padding);
3515 break;
3516 case 'L':
3517 {
3518 const char *local_host;
3519
3520 if (MyProcPort)
3521 {
3522 if (MyProcPort->local_host[0] == '\0')
3523 {
3524 /*
3525 * First time through: cache the lookup, since it
3526 * might not have trivial cost.
3527 */
3531 sizeof(MyProcPort->local_host),
3532 NULL, 0,
3534 }
3535 local_host = MyProcPort->local_host;
3536 }
3537 else
3538 {
3539 /* Background process, or connection not yet made */
3540 local_host = "[none]";
3541 }
3542 if (padding != 0)
3543 appendStringInfo(buf, "%*s", padding, local_host);
3544 else
3545 appendStringInfoString(buf, local_host);
3546 }
3547 break;
3548 case 'r':
3550 {
3551 if (padding != 0)
3552 {
3553 if (MyProcPort->remote_port && MyProcPort->remote_port[0] != '\0')
3554 {
3555 /*
3556 * This option is slightly special as the port
3557 * number may be appended onto the end. Here we
3558 * need to build 1 string which contains the
3559 * remote_host and optionally the remote_port (if
3560 * set) so we can properly align the string.
3561 */
3562
3563 char *hostport;
3564
3566 appendStringInfo(buf, "%*s", padding, hostport);
3567 pfree(hostport);
3568 }
3569 else
3570 appendStringInfo(buf, "%*s", padding, MyProcPort->remote_host);
3571 }
3572 else
3573 {
3574 /* padding is 0, so we don't need a temp buffer */
3576 if (MyProcPort->remote_port &&
3577 MyProcPort->remote_port[0] != '\0')
3578 appendStringInfo(buf, "(%s)",
3580 }
3581 }
3582 else if (padding != 0)
3584 padding > 0 ? padding : -padding);
3585 break;
3586 case 'h':
3588 {
3589 if (padding != 0)
3590 appendStringInfo(buf, "%*s", padding, MyProcPort->remote_host);
3591 else
3593 }
3594 else if (padding != 0)
3596 padding > 0 ? padding : -padding);
3597 break;
3598 case 'q':
3599 /* in postmaster and friends, stop if %q is seen */
3600 /* in a backend, just ignore */
3601 if (MyProcPort == NULL)
3602 return;
3603 break;
3604 case 'v':
3605 /* keep VXID format in sync with lockfuncs.c */
3607 {
3608 if (padding != 0)
3609 {
3610 char strfbuf[128];
3611
3612 snprintf(strfbuf, sizeof(strfbuf) - 1, "%d/%u",
3614 appendStringInfo(buf, "%*s", padding, strfbuf);
3615 }
3616 else
3618 }
3619 else if (padding != 0)
3621 padding > 0 ? padding : -padding);
3622 break;
3623 case 'x':
3624 if (padding != 0)
3625 appendStringInfo(buf, "%*u", padding, GetTopTransactionIdIfAny());
3626 else
3628 break;
3629 case 'e':
3630 if (padding != 0)
3631 appendStringInfo(buf, "%*s", padding, unpack_sql_state(edata->sqlerrcode));
3632 else
3634 break;
3635 case 'Q':
3636 if (padding != 0)
3637 appendStringInfo(buf, "%*" PRId64, padding,
3639 else
3642 break;
3643 default:
3644 /* format error - ignore it */
3645 break;
3646 }
3647 }
3648}
int64 pgstat_get_my_query_id(void)
static const char * process_log_prefix_padding(const char *p, int *ppadding)
Definition elog.c:3230
char * get_formatted_start_time(void)
Definition elog.c:3156
const char * get_backend_type_for_log(void)
Definition elog.c:3203
char * get_formatted_log_time(void)
Definition elog.c:3106
char * unpack_sql_state(int sql_state)
Definition elog.c:3655
#define _(x)
Definition elog.c:96
void reset_formatted_start_time(void)
Definition elog.c:3144
struct Port * MyProcPort
Definition globals.c:53
char * application_name
Definition guc_tables.c:589
static char * username
Definition initdb.c:153
int pg_getnameinfo_all(const struct sockaddr_storage *addr, int salen, char *node, int nodelen, char *service, int servicelen, int flags)
Definition ip.c:117
static char format
static time_t start_time
Definition pg_ctl.c:96
#define snprintf
Definition port.h:260
#define INVALID_PROC_NUMBER
Definition procnumber.h:26
const char * get_ps_display(int *displen)
Definition ps_status.c:549
char * psprintf(const char *fmt,...)
Definition psprintf.c:43
PGPROC * MyProc
Definition proc.c:71
char * dbname
Definition streamutil.c:49
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
Definition stringinfo.c:281
void appendStringInfoSpaces(StringInfo str, int count)
Definition stringinfo.c:260
void appendStringInfoChar(StringInfo str, char ch)
Definition stringinfo.c:242
Definition proc.h:179
LocalTransactionId lxid
Definition proc.h:231
ProcNumber procNumber
Definition proc.h:226
int pid
Definition proc.h:197
struct PGPROC::@136 vxid
PGPROC * lockGroupLeader
Definition proc.h:298
char * user_name
Definition libpq-be.h:151
char * remote_port
Definition libpq-be.h:140
SockAddr laddr
Definition libpq-be.h:133
char * database_name
Definition libpq-be.h:150
char * remote_host
Definition libpq-be.h:135
char local_host[64]
Definition libpq-be.h:143
struct sockaddr_storage addr
Definition pqcomm.h:32
socklen_t salen
Definition pqcomm.h:33
TransactionId GetTopTransactionIdIfAny(void)
Definition xact.c:443

References _, SockAddr::addr, appendBinaryStringInfo(), appendStringInfo(), appendStringInfoChar(), appendStringInfoSpaces(), appendStringInfoString(), application_name, buf, Port::database_name, dbname, fb(), format, formatted_log_time, get_backend_type_for_log(), get_formatted_log_time(), get_formatted_start_time(), get_ps_display(), gettimeofday(), GetTopTransactionIdIfAny(), INVALID_PROC_NUMBER, Port::laddr, Port::local_host, PGPROC::lockGroupLeader, log_timezone, PGPROC::lxid, MyProc, MyProcPid, MyProcPort, MyStartTime, pfree(), pg_getnameinfo_all(), pg_localtime(), pg_strftime(), pgstat_get_my_query_id(), PGPROC::pid, process_log_prefix_padding(), PGPROC::procNumber, psprintf(), Port::remote_host, Port::remote_port, reset_formatted_start_time(), SockAddr::salen, saved_timeval, saved_timeval_set, snprintf, start_time, unpack_sql_state(), Port::user_name, username, and PGPROC::vxid.

Referenced by log_line_prefix().

◆ matches_backtrace_functions()

static bool matches_backtrace_functions ( const char funcname)
static

Definition at line 847 of file elog.c.

848{
849 const char *p;
850
851 if (!backtrace_function_list || funcname == NULL || funcname[0] == '\0')
852 return false;
853
855 for (;;)
856 {
857 if (*p == '\0') /* end of backtrace_function_list */
858 break;
859
860 if (strcmp(funcname, p) == 0)
861 return true;
862 p += strlen(p) + 1;
863 }
864
865 return false;
866}

References backtrace_function_list, fb(), and funcname.

Referenced by errfinish().

◆ message_level_is_interesting()

bool message_level_is_interesting ( int  elevel)

Definition at line 285 of file elog.c.

286{
287 /*
288 * Keep this in sync with the decision-making in errstart().
289 */
290 if (elevel >= ERROR ||
291 should_output_to_server(elevel) ||
293 return true;
294 return false;
295}

References ERROR, should_output_to_client(), and should_output_to_server().

Referenced by log_invalid_page(), PostmasterMain(), ProcessStandbyHSFeedbackMessage(), ProcessStandbyReplyMessage(), ProcessWalSndrMessage(), ProcSleep(), reportDependentObjects(), ShowTransactionState(), and VacuumUpdateCosts().

◆ pg_attribute_unused()

pg_attribute_unused ( )

◆ pg_re_throw()

void pg_re_throw ( void  )

Definition at line 2200 of file elog.c.

2201{
2202 /* If possible, throw the error to the next outer setjmp handler */
2203 if (PG_exception_stack != NULL)
2205 else
2206 {
2207 /*
2208 * If we get here, elog(ERROR) was thrown inside a PG_TRY block, which
2209 * we have now exited only to discover that there is no outer setjmp
2210 * handler to pass the error to. Had the error been thrown outside
2211 * the block to begin with, we'd have promoted the error to FATAL, so
2212 * the correct behavior is to make it FATAL now; that is, emit it and
2213 * then call proc_exit.
2214 */
2216
2218 Assert(edata->elevel == ERROR);
2219 edata->elevel = FATAL;
2220
2221 /*
2222 * At least in principle, the increase in severity could have changed
2223 * where-to-output decisions, so recalculate.
2224 */
2225 edata->output_to_server = should_output_to_server(FATAL);
2226 edata->output_to_client = should_output_to_client(FATAL);
2227
2228 /*
2229 * We can use errfinish() for the rest, but we don't want it to call
2230 * any error context routines a second time. Since we know we are
2231 * about to exit, it should be OK to just clear the context stack.
2232 */
2234
2235 errfinish(edata->filename, edata->lineno, edata->funcname);
2236 }
2237
2238 /* Doesn't return ... */
2239 ExceptionalCondition("pg_re_throw tried to return", __FILE__, __LINE__);
2240}
void ExceptionalCondition(const char *conditionName, const char *fileName, int lineNumber)
Definition assert.c:30

References Assert, errfinish(), ERROR, error_context_stack, errordata, errordata_stack_depth, ExceptionalCondition(), FATAL, fb(), PG_exception_stack, should_output_to_client(), and should_output_to_server().

◆ pre_format_elog_string()

void pre_format_elog_string ( int  errnumber,
const char domain 
)

Definition at line 1841 of file elog.c.

1842{
1843 /* Save errno before evaluation of argument functions can change it */
1845 /* Save caller's text domain */
1846 save_format_domain = domain;
1847}

References fb(), and save_format_domain.

◆ process_log_prefix_padding()

static const char * process_log_prefix_padding ( const char p,
int ppadding 
)
static

Definition at line 3230 of file elog.c.

3231{
3232 int paddingsign = 1;
3233 int padding = 0;
3234
3235 if (*p == '-')
3236 {
3237 p++;
3238
3239 if (*p == '\0') /* Did the buf end in %- ? */
3240 return NULL;
3241 paddingsign = -1;
3242 }
3243
3244 /* generate an int version of the numerical string */
3245 while (*p >= '0' && *p <= '9')
3246 padding = padding * 10 + (*p++ - '0');
3247
3248 /* format is invalid if it ends with the padding number */
3249 if (*p == '\0')
3250 return NULL;
3251
3252 padding *= paddingsign;
3253 *ppadding = padding;
3254 return p;
3255}

References fb().

Referenced by log_status_format().

◆ reset_formatted_start_time()

void reset_formatted_start_time ( void  )

Definition at line 3144 of file elog.c.

3145{
3146 formatted_start_time[0] = '\0';
3147}

References formatted_start_time.

Referenced by log_status_format(), write_csvlog(), and write_jsonlog().

◆ ReThrowError()

void ReThrowError ( ErrorData edata)

Definition at line 2150 of file elog.c.

2151{
2153
2154 Assert(edata->elevel == ERROR);
2155
2156 /* Push the data back into the error context */
2159
2161 memcpy(newedata, edata, sizeof(ErrorData));
2162
2163 /* Make copies of separately-allocated fields */
2164 if (newedata->message)
2165 newedata->message = pstrdup(newedata->message);
2166 if (newedata->detail)
2167 newedata->detail = pstrdup(newedata->detail);
2168 if (newedata->detail_log)
2169 newedata->detail_log = pstrdup(newedata->detail_log);
2170 if (newedata->hint)
2171 newedata->hint = pstrdup(newedata->hint);
2172 if (newedata->context)
2173 newedata->context = pstrdup(newedata->context);
2174 if (newedata->backtrace)
2175 newedata->backtrace = pstrdup(newedata->backtrace);
2176 if (newedata->schema_name)
2177 newedata->schema_name = pstrdup(newedata->schema_name);
2178 if (newedata->table_name)
2179 newedata->table_name = pstrdup(newedata->table_name);
2180 if (newedata->column_name)
2181 newedata->column_name = pstrdup(newedata->column_name);
2182 if (newedata->datatype_name)
2183 newedata->datatype_name = pstrdup(newedata->datatype_name);
2184 if (newedata->constraint_name)
2185 newedata->constraint_name = pstrdup(newedata->constraint_name);
2186 if (newedata->internalquery)
2187 newedata->internalquery = pstrdup(newedata->internalquery);
2188
2189 /* Reset the assoc_context to be ErrorContext */
2190 newedata->assoc_context = ErrorContext;
2191
2193 PG_RE_THROW();
2194}

References Assert, ERROR, ErrorContext, fb(), get_error_stack_entry(), memcpy(), MemoryContextSwitchTo(), PG_RE_THROW, pstrdup(), and recursion_depth.

Referenced by _SPI_commit(), _SPI_rollback(), exec_stmt_block(), and exec_stmt_raise().

◆ send_message_to_frontend()

static void send_message_to_frontend ( ErrorData edata)
static

Definition at line 3979 of file elog.c.

3980{
3982
3983 /*
3984 * We no longer support pre-3.0 FE/BE protocol, except here. If a client
3985 * tries to connect using an older protocol version, it's nice to send the
3986 * "protocol version not supported" error in a format the client
3987 * understands. If protocol hasn't been set yet, early in backend
3988 * startup, assume modern protocol.
3989 */
3991 {
3992 /* New style with separate fields */
3993 const char *sev;
3994 char tbuf[12];
3995
3996 /* 'N' (Notice) is for nonfatal conditions, 'E' is for errors */
3997 if (edata->elevel < ERROR)
3999 else
4001
4002 sev = error_severity(edata->elevel);
4007
4010
4011 /* M field is required per protocol, so always send something */
4013 if (edata->message)
4014 err_sendstring(&msgbuf, edata->message);
4015 else
4016 err_sendstring(&msgbuf, _("missing error text"));
4017
4018 if (edata->detail)
4019 {
4021 err_sendstring(&msgbuf, edata->detail);
4022 }
4023
4024 /* detail_log is intentionally not used here */
4025
4026 if (edata->hint)
4027 {
4029 err_sendstring(&msgbuf, edata->hint);
4030 }
4031
4032 if (edata->context)
4033 {
4035 err_sendstring(&msgbuf, edata->context);
4036 }
4037
4038 if (edata->schema_name)
4039 {
4041 err_sendstring(&msgbuf, edata->schema_name);
4042 }
4043
4044 if (edata->table_name)
4045 {
4047 err_sendstring(&msgbuf, edata->table_name);
4048 }
4049
4050 if (edata->column_name)
4051 {
4053 err_sendstring(&msgbuf, edata->column_name);
4054 }
4055
4056 if (edata->datatype_name)
4057 {
4059 err_sendstring(&msgbuf, edata->datatype_name);
4060 }
4061
4062 if (edata->constraint_name)
4063 {
4065 err_sendstring(&msgbuf, edata->constraint_name);
4066 }
4067
4068 if (edata->cursorpos > 0)
4069 {
4070 snprintf(tbuf, sizeof(tbuf), "%d", edata->cursorpos);
4073 }
4074
4075 if (edata->internalpos > 0)
4076 {
4077 snprintf(tbuf, sizeof(tbuf), "%d", edata->internalpos);
4080 }
4081
4082 if (edata->internalquery)
4083 {
4085 err_sendstring(&msgbuf, edata->internalquery);
4086 }
4087
4088 if (edata->filename)
4089 {
4091 err_sendstring(&msgbuf, edata->filename);
4092 }
4093
4094 if (edata->lineno > 0)
4095 {
4096 snprintf(tbuf, sizeof(tbuf), "%d", edata->lineno);
4099 }
4100
4101 if (edata->funcname)
4102 {
4104 err_sendstring(&msgbuf, edata->funcname);
4105 }
4106
4107 pq_sendbyte(&msgbuf, '\0'); /* terminator */
4108
4110 }
4111 else
4112 {
4113 /* Old style --- gin up a backwards-compatible message */
4115
4117
4118 appendStringInfo(&buf, "%s: ", _(error_severity(edata->elevel)));
4119
4120 if (edata->message)
4121 appendStringInfoString(&buf, edata->message);
4122 else
4123 appendStringInfoString(&buf, _("missing error text"));
4124
4125 appendStringInfoChar(&buf, '\n');
4126
4127 /* 'N' (Notice) is for nonfatal conditions, 'E' is for errors */
4128 pq_putmessage_v2((edata->elevel < ERROR) ? 'N' : 'E', buf.data, buf.len + 1);
4129
4130 pfree(buf.data);
4131 }
4132
4133 /*
4134 * This flush is normally not necessary, since postgres.c will flush out
4135 * waiting data when control returns to the main loop. But it seems best
4136 * to leave it here, so that the client has some clue what happened if the
4137 * backend dies before getting back to the main loop ... error/notice
4138 * messages should not be a performance-critical path anyway, so an extra
4139 * flush won't hurt much ...
4140 */
4141 pq_flush();
4142}
static void err_sendstring(StringInfo buf, const char *str)
Definition elog.c:3967
const char * error_severity(int elevel)
Definition elog.c:4157
ProtocolVersion FrontendProtocol
Definition globals.c:30
#define pq_flush()
Definition libpq.h:49
const void size_t len
const void * data
#define PG_DIAG_INTERNAL_QUERY
#define PG_DIAG_SCHEMA_NAME
#define PG_DIAG_CONSTRAINT_NAME
#define PG_DIAG_DATATYPE_NAME
#define PG_DIAG_SOURCE_LINE
#define PG_DIAG_STATEMENT_POSITION
#define PG_DIAG_SOURCE_FILE
#define PG_DIAG_MESSAGE_HINT
#define PG_DIAG_SQLSTATE
#define PG_DIAG_SEVERITY_NONLOCALIZED
#define PG_DIAG_TABLE_NAME
#define PG_DIAG_MESSAGE_PRIMARY
#define PG_DIAG_COLUMN_NAME
#define PG_DIAG_MESSAGE_DETAIL
#define PG_DIAG_CONTEXT
#define PG_DIAG_SEVERITY
#define PG_DIAG_SOURCE_FUNCTION
#define PG_DIAG_INTERNAL_POSITION
int pq_putmessage_v2(char msgtype, const char *s, size_t len)
Definition pqcomm.c:1562
#define PG_PROTOCOL_MAJOR(v)
Definition pqcomm.h:86
void pq_endmessage(StringInfo buf)
Definition pqformat.c:296
void pq_beginmessage(StringInfo buf, char msgtype)
Definition pqformat.c:88
static void pq_sendbyte(StringInfo buf, uint8 byt)
Definition pqformat.h:160
#define PqMsg_ErrorResponse
Definition protocol.h:44
#define PqMsg_NoticeResponse
Definition protocol.h:49
void initStringInfo(StringInfo str)
Definition stringinfo.c:97

References _, appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), buf, err_sendstring(), ERROR, error_severity(), fb(), FrontendProtocol, initStringInfo(), pfree(), PG_DIAG_COLUMN_NAME, PG_DIAG_CONSTRAINT_NAME, PG_DIAG_CONTEXT, PG_DIAG_DATATYPE_NAME, PG_DIAG_INTERNAL_POSITION, PG_DIAG_INTERNAL_QUERY, PG_DIAG_MESSAGE_DETAIL, PG_DIAG_MESSAGE_HINT, PG_DIAG_MESSAGE_PRIMARY, PG_DIAG_SCHEMA_NAME, PG_DIAG_SEVERITY, PG_DIAG_SEVERITY_NONLOCALIZED, PG_DIAG_SOURCE_FILE, PG_DIAG_SOURCE_FUNCTION, PG_DIAG_SOURCE_LINE, PG_DIAG_SQLSTATE, PG_DIAG_STATEMENT_POSITION, PG_DIAG_TABLE_NAME, PG_PROTOCOL_MAJOR, pq_beginmessage(), pq_endmessage(), pq_flush, pq_putmessage_v2(), pq_sendbyte(), PqMsg_ErrorResponse, PqMsg_NoticeResponse, snprintf, and unpack_sql_state().

Referenced by EmitErrorReport().

◆ send_message_to_server_log()

static void send_message_to_server_log ( ErrorData edata)
static

Definition at line 3675 of file elog.c.

3676{
3678 bool fallback_to_stderr = false;
3679
3681
3683 appendStringInfo(&buf, "%s: ", _(error_severity(edata->elevel)));
3684
3686 appendStringInfo(&buf, "%s: ", unpack_sql_state(edata->sqlerrcode));
3687
3688 if (edata->message)
3689 append_with_tabs(&buf, edata->message);
3690 else
3691 append_with_tabs(&buf, _("missing error text"));
3692
3693 if (edata->cursorpos > 0)
3694 appendStringInfo(&buf, _(" at character %d"),
3695 edata->cursorpos);
3696 else if (edata->internalpos > 0)
3697 appendStringInfo(&buf, _(" at character %d"),
3698 edata->internalpos);
3699
3700 appendStringInfoChar(&buf, '\n');
3701
3703 {
3704 if (edata->detail_log)
3705 {
3707 appendStringInfoString(&buf, _("DETAIL: "));
3708 append_with_tabs(&buf, edata->detail_log);
3709 appendStringInfoChar(&buf, '\n');
3710 }
3711 else if (edata->detail)
3712 {
3714 appendStringInfoString(&buf, _("DETAIL: "));
3715 append_with_tabs(&buf, edata->detail);
3716 appendStringInfoChar(&buf, '\n');
3717 }
3718 if (edata->hint)
3719 {
3721 appendStringInfoString(&buf, _("HINT: "));
3722 append_with_tabs(&buf, edata->hint);
3723 appendStringInfoChar(&buf, '\n');
3724 }
3725 if (edata->internalquery)
3726 {
3728 appendStringInfoString(&buf, _("QUERY: "));
3729 append_with_tabs(&buf, edata->internalquery);
3730 appendStringInfoChar(&buf, '\n');
3731 }
3732 if (edata->context && !edata->hide_ctx)
3733 {
3735 appendStringInfoString(&buf, _("CONTEXT: "));
3736 append_with_tabs(&buf, edata->context);
3737 appendStringInfoChar(&buf, '\n');
3738 }
3740 {
3741 /* assume no newlines in funcname or filename... */
3742 if (edata->funcname && edata->filename)
3743 {
3745 appendStringInfo(&buf, _("LOCATION: %s, %s:%d\n"),
3746 edata->funcname, edata->filename,
3747 edata->lineno);
3748 }
3749 else if (edata->filename)
3750 {
3752 appendStringInfo(&buf, _("LOCATION: %s:%d\n"),
3753 edata->filename, edata->lineno);
3754 }
3755 }
3756 if (edata->backtrace)
3757 {
3759 appendStringInfoString(&buf, _("BACKTRACE: "));
3760 append_with_tabs(&buf, edata->backtrace);
3761 appendStringInfoChar(&buf, '\n');
3762 }
3763 }
3764
3765 /*
3766 * If the user wants the query that generated this error logged, do it.
3767 */
3769 {
3771 appendStringInfoString(&buf, _("STATEMENT: "));
3773 appendStringInfoChar(&buf, '\n');
3774 }
3775
3776#ifdef HAVE_SYSLOG
3777 /* Write to syslog, if enabled */
3779 {
3780 int syslog_level;
3781
3782 switch (edata->elevel)
3783 {
3784 case DEBUG5:
3785 case DEBUG4:
3786 case DEBUG3:
3787 case DEBUG2:
3788 case DEBUG1:
3790 break;
3791 case LOG:
3792 case LOG_SERVER_ONLY:
3793 case INFO:
3795 break;
3796 case NOTICE:
3797 case WARNING:
3800 break;
3801 case ERROR:
3803 break;
3804 case FATAL:
3805 case FATAL_CLIENT_ONLY:
3807 break;
3808 case PANIC:
3809 default:
3811 break;
3812 }
3813
3815 }
3816#endif /* HAVE_SYSLOG */
3817
3818#ifdef WIN32
3819 /* Write to eventlog, if enabled */
3821 {
3822 write_eventlog(edata->elevel, buf.data, buf.len);
3823 }
3824#endif /* WIN32 */
3825
3826 /* Write to csvlog, if enabled */
3828 {
3829 /*
3830 * Send CSV data if it's safe to do so (syslogger doesn't need the
3831 * pipe). If this is not possible, fallback to an entry written to
3832 * stderr.
3833 */
3836 else
3837 fallback_to_stderr = true;
3838 }
3839
3840 /* Write to JSON log, if enabled */
3842 {
3843 /*
3844 * Send JSON data if it's safe to do so (syslogger doesn't need the
3845 * pipe). If this is not possible, fallback to an entry written to
3846 * stderr.
3847 */
3849 {
3851 }
3852 else
3853 fallback_to_stderr = true;
3854 }
3855
3856 /*
3857 * Write to stderr, if enabled or if required because of a previous
3858 * limitation.
3859 */
3863 {
3864 /*
3865 * Use the chunking protocol if we know the syslogger should be
3866 * catching stderr output, and we are not ourselves the syslogger.
3867 * Otherwise, just do a vanilla write to stderr.
3868 */
3871#ifdef WIN32
3872
3873 /*
3874 * In a win32 service environment, there is no usable stderr. Capture
3875 * anything going there and write it to the eventlog instead.
3876 *
3877 * If stderr redirection is active, it was OK to write to stderr above
3878 * because that's really a pipe to the syslogger process.
3879 */
3880 else if (pgwin32_is_service())
3881 write_eventlog(edata->elevel, buf.data, buf.len);
3882#endif
3883 else
3884 write_console(buf.data, buf.len);
3885 }
3886
3887 /* If in the syslogger process, try to write messages direct to file */
3888 if (MyBackendType == B_LOGGER)
3890
3891 /* No more need of the message formatted for stderr */
3892 pfree(buf.data);
3893}
void write_csvlog(ErrorData *edata)
Definition csvlog.c:63
@ DestDebug
Definition dest.h:88
static void log_line_prefix(StringInfo buf, ErrorData *edata)
Definition elog.c:3261
bool check_log_of_query(ErrorData *edata)
Definition elog.c:3180
static void append_with_tabs(StringInfo buf, const char *str)
Definition elog.c:4210
int Log_error_verbosity
Definition elog.c:114
void write_pipe_chunks(char *data, int len, int dest)
Definition elog.c:3916
static void write_console(const char *line, int len)
Definition elog.c:3028
@ PGERROR_VERBOSE
Definition elog.h:476
@ PGERROR_DEFAULT
Definition elog.h:475
void write_jsonlog(ErrorData *edata)
Definition jsonlog.c:109
@ B_LOGGER
Definition miscadmin.h:389
bool redirection_done
Definition postmaster.c:377
void write_syslogger_file(const char *buffer, int count, int destination)
Definition syslogger.c:1093
int pgwin32_is_service(void)

References _, append_with_tabs(), appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), B_LOGGER, buf, check_log_of_query(), DEBUG1, DEBUG2, DEBUG3, DEBUG4, DEBUG5, debug_query_string, DestDebug, ERROR, error_severity(), FATAL, FATAL_CLIENT_ONLY, fb(), INFO, initStringInfo(), LOG, Log_destination, LOG_DESTINATION_CSVLOG, LOG_DESTINATION_EVENTLOG, LOG_DESTINATION_JSONLOG, LOG_DESTINATION_STDERR, LOG_DESTINATION_SYSLOG, Log_error_verbosity, log_line_prefix(), LOG_SERVER_ONLY, MyBackendType, NOTICE, PANIC, pfree(), PGERROR_DEFAULT, PGERROR_VERBOSE, pgwin32_is_service(), redirection_done, unpack_sql_state(), WARNING, WARNING_CLIENT_ONLY, whereToSendOutput, write_console(), write_csvlog(), write_jsonlog(), write_pipe_chunks(), and write_syslogger_file().

Referenced by EmitErrorReport().

◆ set_backtrace()

static void set_backtrace ( ErrorData edata,
int  num_skip 
)
static

Definition at line 1147 of file elog.c.

1148{
1150
1152
1153#ifdef HAVE_BACKTRACE_SYMBOLS
1154 {
1155 void *frames[100];
1156 int nframes;
1157 char **strfrms;
1158
1159 nframes = backtrace(frames, lengthof(frames));
1161 if (strfrms != NULL)
1162 {
1163 for (int i = num_skip; i < nframes; i++)
1164 appendStringInfo(&errtrace, "\n%s", strfrms[i]);
1165 free(strfrms);
1166 }
1167 else
1169 "insufficient memory for backtrace generation");
1170 }
1171#elif defined(_MSC_VER)
1172 {
1173 void *frames[100];
1174 int nframes;
1175 char buffer[sizeof(SYMBOL_INFOW) + MAX_SYM_NAME * sizeof(wchar_t)];
1177
1178 /*
1179 * This is arranged so that we don't retry if we happen to fail to
1180 * initialize state on the first attempt in any one process.
1181 */
1183 {
1185
1190 0,
1191 FALSE,
1193 {
1195 "could not get process handle for backtrace: error code %lu",
1196 GetLastError());
1197 edata->backtrace = errtrace.data;
1198 return;
1199 }
1200
1205
1207 {
1211 "could not initialize symbol handler: error code %lu",
1212 GetLastError());
1213 edata->backtrace = errtrace.data;
1214 return;
1215 }
1216
1218 }
1219
1220 if (backtrace_process == NULL)
1221 return;
1222
1224
1225 if (nframes == 0)
1226 {
1227 appendStringInfoString(&errtrace, "zero stack frames captured");
1228 edata->backtrace = errtrace.data;
1229 return;
1230 }
1231
1232 psymbol = (PSYMBOL_INFOW) buffer;
1233 psymbol->MaxNameLen = MAX_SYM_NAME;
1234 psymbol->SizeOfStruct = sizeof(SYMBOL_INFOW);
1235
1236 for (int i = 0; i < nframes; i++)
1237 {
1238 DWORD64 address = (DWORD64) frames[i];
1241
1243 address,
1244 &displacement,
1245 psymbol);
1246 if (sym_result == TRUE)
1247 {
1249 size_t result;
1250
1251 /*
1252 * Convert symbol name from UTF-16 to database encoding using
1253 * wchar2char(), which handles both UTF-8 and non-UTF-8
1254 * databases correctly on Windows.
1255 */
1256 result = wchar2char(symbol_name, (const wchar_t *) psymbol->Name,
1257 sizeof(symbol_name), NULL);
1258
1259 if (result == (size_t) -1 || result == sizeof(symbol_name))
1260 {
1261 /* Conversion failed, use address only */
1263 "\n[0x%llx]",
1264 (unsigned long long) address);
1265 }
1266 else
1267 {
1268 IMAGEHLP_LINEW64 line;
1270 char filename[MAX_PATH];
1271
1272 line.SizeOfStruct = sizeof(IMAGEHLP_LINEW64);
1273
1274 /* Start with the common part: symbol+offset [address] */
1276 "\n%s+0x%llx [0x%llx]",
1278 (unsigned long long) displacement,
1279 (unsigned long long) address);
1280
1281 /* Try to append line info if available */
1283 address,
1285 &line))
1286 {
1287 result = wchar2char(filename, (const wchar_t *) line.FileName,
1288 sizeof(filename), NULL);
1289
1290 if (result != (size_t) -1 && result != sizeof(filename))
1291 {
1293 " [%s:%lu]",
1294 filename,
1295 (unsigned long) line.LineNumber);
1296 }
1297 }
1298 }
1299 }
1300 else
1301 {
1303 "\n[0x%llx] (symbol lookup failed: error code %lu)",
1304 (unsigned long long) address,
1305 GetLastError());
1306 }
1307 }
1308 }
1309#else
1311 "backtrace generation is not supported by this installation");
1312#endif
1313
1314 edata->backtrace = errtrace.data;
1315}
#define lengthof(array)
Definition c.h:873
static void backtrace_cleanup(int code, Datum arg)
void on_proc_exit(pg_on_exit_callback function, Datum arg)
Definition ipc.c:316
size_t wchar2char(char *to, const wchar_t *from, size_t tolen, locale_t loc)

References appendStringInfo(), appendStringInfoString(), backtrace_cleanup(), fb(), filename, free, i, initStringInfo(), lengthof, on_proc_exit(), result, and wchar2char().

Referenced by errbacktrace(), and errfinish().

◆ set_errdata_field()

static void set_errdata_field ( MemoryContextData cxt,
char **  ptr,
const char str 
)
static

◆ set_stack_entry_domain()

static void set_stack_entry_domain ( ErrorData edata,
const char domain 
)
static

Definition at line 800 of file elog.c.

801{
802 /* the default text domain is the backend's */
803 edata->domain = domain ? domain : PG_TEXTDOMAIN("postgres");
804 /* initialize context_domain the same way (see set_errcontext_domain()) */
805 edata->context_domain = edata->domain;
806}

References fb(), and PG_TEXTDOMAIN.

Referenced by errsave_start(), and errstart().

◆ set_stack_entry_location()

static void set_stack_entry_location ( ErrorData edata,
const char filename,
int  lineno,
const char funcname 
)
static

Definition at line 817 of file elog.c.

820{
821 if (filename)
822 {
823 const char *slash;
824
825 /* keep only base name, useful especially for vpath builds */
826 slash = strrchr(filename, '/');
827 if (slash)
828 filename = slash + 1;
829 /* Some Windows compilers use backslashes in __FILE__ strings */
830 slash = strrchr(filename, '\\');
831 if (slash)
832 filename = slash + 1;
833 }
834
835 edata->filename = filename;
836 edata->lineno = lineno;
837 edata->funcname = funcname;
838}

References fb(), filename, and funcname.

Referenced by errfinish(), and errsave_finish().

◆ should_output_to_client()

static bool should_output_to_client ( int  elevel)
inlinestatic

Definition at line 257 of file elog.c.

258{
259 if (whereToSendOutput == DestRemote && elevel != LOG_SERVER_ONLY)
260 {
261 /*
262 * client_min_messages is honored only after we complete the
263 * authentication handshake. This is required both for security
264 * reasons and because many clients can't handle NOTICE messages
265 * during authentication.
266 */
268 return (elevel >= ERROR);
269 else
270 return (elevel >= client_min_messages || elevel == INFO);
271 }
272 return false;
273}
int client_min_messages
Definition guc_tables.c:568
bool ClientAuthInProgress
Definition postmaster.c:374

References client_min_messages, ClientAuthInProgress, DestRemote, ERROR, INFO, LOG_SERVER_ONLY, and whereToSendOutput.

Referenced by errstart(), message_level_is_interesting(), and pg_re_throw().

◆ should_output_to_server()

static bool should_output_to_server ( int  elevel)
inlinestatic

Definition at line 248 of file elog.c.

249{
251}

References is_log_level_output(), log_min_messages, and MyBackendType.

Referenced by errstart(), message_level_is_interesting(), and pg_re_throw().

◆ ThrowErrorData()

void ThrowErrorData ( ErrorData edata)

Definition at line 2091 of file elog.c.

2092{
2094 MemoryContext oldcontext;
2095
2096 if (!errstart(edata->elevel, edata->domain))
2097 return; /* error is not to be reported at all */
2098
2101 oldcontext = MemoryContextSwitchTo(newedata->assoc_context);
2102
2103 /* Copy the supplied fields to the error stack entry. */
2104 if (edata->sqlerrcode != 0)
2105 newedata->sqlerrcode = edata->sqlerrcode;
2106 if (edata->message)
2107 newedata->message = pstrdup(edata->message);
2108 if (edata->detail)
2109 newedata->detail = pstrdup(edata->detail);
2110 if (edata->detail_log)
2111 newedata->detail_log = pstrdup(edata->detail_log);
2112 if (edata->hint)
2113 newedata->hint = pstrdup(edata->hint);
2114 if (edata->context)
2115 newedata->context = pstrdup(edata->context);
2116 if (edata->backtrace)
2117 newedata->backtrace = pstrdup(edata->backtrace);
2118 /* assume message_id is not available */
2119 if (edata->schema_name)
2120 newedata->schema_name = pstrdup(edata->schema_name);
2121 if (edata->table_name)
2122 newedata->table_name = pstrdup(edata->table_name);
2123 if (edata->column_name)
2124 newedata->column_name = pstrdup(edata->column_name);
2125 if (edata->datatype_name)
2126 newedata->datatype_name = pstrdup(edata->datatype_name);
2127 if (edata->constraint_name)
2128 newedata->constraint_name = pstrdup(edata->constraint_name);
2129 newedata->cursorpos = edata->cursorpos;
2130 newedata->internalpos = edata->internalpos;
2131 if (edata->internalquery)
2132 newedata->internalquery = pstrdup(edata->internalquery);
2133
2134 MemoryContextSwitchTo(oldcontext);
2136
2137 /* Process the error. */
2138 errfinish(edata->filename, edata->lineno, edata->funcname);
2139}

References errfinish(), errordata, errordata_stack_depth, errstart(), fb(), MemoryContextSwitchTo(), pstrdup(), and recursion_depth.

Referenced by array_in_safe(), jbv_to_infunc_datum(), ProcessParallelMessage(), ProcessRepackMessage(), and statatt_build_stavalues().

◆ unpack_sql_state()

char * unpack_sql_state ( int  sql_state)

Definition at line 3655 of file elog.c.

3656{
3657 static char buf[12];
3658 int i;
3659
3660 for (i = 0; i < 5; i++)
3661 {
3663 sql_state >>= 6;
3664 }
3665
3666 buf[i] = '\0';
3667 return buf;
3668}
#define PGUNSIXBIT(val)
Definition elog.h:56

References buf, fb(), i, and PGUNSIXBIT.

Referenced by exec_stmt_block(), exec_stmt_getdiag(), exec_stmt_raise(), log_status_format(), pg_input_error_info(), pltcl_construct_errorCode(), PLy_exception_set_with_details(), PLy_generate_spi_exceptions(), send_message_to_frontend(), send_message_to_server_log(), write_csvlog(), and write_jsonlog().

◆ vwrite_stderr()

void vwrite_stderr ( const char fmt,
va_list  ap 
)

Definition at line 4244 of file elog.c.

4245{
4246#ifdef WIN32
4247 char errbuf[2048]; /* Arbitrary size? */
4248#endif
4249
4250 fmt = _(fmt);
4251#ifndef WIN32
4252 /* On Unix, we just fprintf to stderr */
4253 vfprintf(stderr, fmt, ap);
4254 fflush(stderr);
4255#else
4256 vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
4257
4258 /*
4259 * On Win32, we print to stderr if running on a console, or write to
4260 * eventlog if running as a service
4261 */
4262 if (pgwin32_is_service()) /* Running as a service */
4263 {
4264 write_eventlog(ERROR, errbuf, strlen(errbuf));
4265 }
4266 else
4267 {
4268 /* Not running as service, write to stderr */
4269 write_console(errbuf, strlen(errbuf));
4270 fflush(stderr);
4271 }
4272#endif
4273}
#define vsnprintf
Definition port.h:259
#define vfprintf
Definition port.h:263

References _, ERROR, fb(), pgwin32_is_service(), vfprintf, vsnprintf, and write_console().

Referenced by log_error(), and write_stderr().

◆ write_console()

static void write_console ( const char line,
int  len 
)
static

Definition at line 3028 of file elog.c.

3029{
3030 int rc;
3031
3032#ifdef WIN32
3033
3034 /*
3035 * Try to convert the message to UTF16 and write it with WriteConsoleW().
3036 * Fall back on write() if anything fails.
3037 *
3038 * In contrast to write_eventlog(), don't skip straight to write() based
3039 * on the applicable encodings. Unlike WriteConsoleW(), write() depends
3040 * on the suitability of the console output code page. Since we put
3041 * stderr into binary mode in SubPostmasterMain(), write() skips the
3042 * necessary translation anyway.
3043 *
3044 * WriteConsoleW() will fail if stderr is redirected, so just fall through
3045 * to writing unconverted to the logfile in this case.
3046 *
3047 * Since we palloc the structure required for conversion, also fall
3048 * through to writing unconverted if we have not yet set up
3049 * CurrentMemoryContext.
3050 */
3054 {
3055 WCHAR *utf16;
3056 int utf16len;
3057
3059 if (utf16 != NULL)
3060 {
3062 DWORD written;
3063
3066 {
3067 pfree(utf16);
3068 return;
3069 }
3070
3071 /*
3072 * In case WriteConsoleW() failed, fall back to writing the
3073 * message unconverted.
3074 */
3075 pfree(utf16);
3076 }
3077 }
3078#else
3079
3080 /*
3081 * Conversion on non-win32 platforms is not implemented yet. It requires
3082 * non-throw version of pg_do_encoding_conversion(), that converts
3083 * unconvertible characters to '?' without errors.
3084 *
3085 * XXX: We have a no-throw version now. It doesn't convert to '?' though.
3086 */
3087#endif
3088
3089 /*
3090 * We ignore any error from write() here. We have no useful way to report
3091 * it ... certainly whining on stderr isn't likely to be productive.
3092 */
3093 rc = write(fileno(stderr), line, len);
3094 (void) rc;
3095}
#define write(a, b, c)
Definition win32.h:14

References CurrentMemoryContext, fb(), in_error_recursion_trouble(), len, pfree(), redirection_done, and write.

Referenced by send_message_to_server_log(), and vwrite_stderr().

◆ write_pipe_chunks()

void write_pipe_chunks ( char data,
int  len,
int  dest 
)

Definition at line 3916 of file elog.c.

3917{
3919 int fd = fileno(stderr);
3920 int rc;
3921
3922 Assert(len > 0);
3923
3924 p.proto.nuls[0] = p.proto.nuls[1] = '\0';
3925 p.proto.pid = MyProcPid;
3926 p.proto.flags = 0;
3927 if (dest == LOG_DESTINATION_STDERR)
3929 else if (dest == LOG_DESTINATION_CSVLOG)
3931 else if (dest == LOG_DESTINATION_JSONLOG)
3933
3934 /* write all but the last chunk */
3935 while (len > PIPE_MAX_PAYLOAD)
3936 {
3937 /* no need to set PIPE_PROTO_IS_LAST yet */
3941 (void) rc;
3944 }
3945
3946 /* write the last chunk */
3948 p.proto.len = len;
3949 memcpy(p.proto.data, data, len);
3950 rc = write(fd, &p, PIPE_HEADER_SIZE + len);
3951 (void) rc;
3952}
char data[FLEXIBLE_ARRAY_MEMBER]
Definition syslogger.h:50
#define PIPE_PROTO_DEST_JSONLOG
Definition syslogger.h:67
#define PIPE_PROTO_IS_LAST
Definition syslogger.h:63
#define PIPE_PROTO_DEST_CSVLOG
Definition syslogger.h:66
#define PIPE_PROTO_DEST_STDERR
Definition syslogger.h:65
#define PIPE_MAX_PAYLOAD
Definition syslogger.h:60
#define PIPE_HEADER_SIZE
Definition syslogger.h:59
PipeProtoHeader proto
Definition syslogger.h:55

References Assert, PipeProtoHeader::data, data, fb(), fd(), PipeProtoHeader::flags, PipeProtoHeader::len, len, LOG_DESTINATION_CSVLOG, LOG_DESTINATION_JSONLOG, LOG_DESTINATION_STDERR, memcpy(), MyProcPid, PipeProtoHeader::nuls, PipeProtoHeader::pid, PIPE_HEADER_SIZE, PIPE_MAX_PAYLOAD, PIPE_PROTO_DEST_CSVLOG, PIPE_PROTO_DEST_JSONLOG, PIPE_PROTO_DEST_STDERR, PIPE_PROTO_IS_LAST, PipeProtoChunk::proto, and write.

Referenced by send_message_to_server_log(), write_csvlog(), and write_jsonlog().

◆ write_stderr()

static void write_stderr ( const char fmt,
  ... 
)

Definition at line 4229 of file elog.c.

4230{
4231 va_list ap;
4232
4233 va_start(ap, fmt);
4235 va_end(ap);
4236}
void vwrite_stderr(const char *fmt, va_list ap)
Definition elog.c:4244

References fb(), and vwrite_stderr().

Variable Documentation

◆ arg

Datum arg

Definition at line 1322 of file elog.c.

1323{
1324#ifdef _MSC_VER
1325 /*
1326 * Currently only used to clean up after SymInitialize. We shouldn't ever
1327 * be called if backtrace_process is NULL, but better be safe.
1328 */
1330 {
1333 }
1334#endif
1335}
1336
1337/*
1338 * errmsg_internal --- add a primary error message text to the current error
1339 *
1340 * This is exactly like errmsg() except that strings passed to errmsg_internal
1341 * are not translated, and are customarily left out of the
1342 * internationalization message dictionary. This should be used for "can't
1343 * happen" cases that are probably not worth spending translation effort on.
1344 * We also use this for certain cases where we *must* not try to translate
1345 * the message because the translation would fail and result in infinite
1346 * error recursion.
1347 */
1348int
1349errmsg_internal(const char *fmt,...)
1350{
1352 MemoryContext oldcontext;
1353
1356 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1357
1358 edata->message_id = fmt;
1359 EVALUATE_MESSAGE(edata->domain, message, false, false);
1360
1361 MemoryContextSwitchTo(oldcontext);
1363 return 0; /* return value does not matter */
1364}
1365
1366
1367/*
1368 * errmsg_plural --- add a primary error message text to the current error,
1369 * with support for pluralization of the message text
1370 */
1371int
1372errmsg_plural(const char *fmt_singular, const char *fmt_plural,
1373 unsigned long n,...)
1374{
1376 MemoryContext oldcontext;
1377
1380 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1381
1382 edata->message_id = fmt_singular;
1383 EVALUATE_MESSAGE_PLURAL(edata->domain, message, false);
1384
1385 MemoryContextSwitchTo(oldcontext);
1387 return 0; /* return value does not matter */
1388}
1389
1390
1391/*
1392 * errdetail --- add a detail error message text to the current error
1393 */
1394int
1395errdetail(const char *fmt,...)
1396{
1398 MemoryContext oldcontext;
1399
1402 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1403
1404 EVALUATE_MESSAGE(edata->domain, detail, false, true);
1405
1406 MemoryContextSwitchTo(oldcontext);
1408 return 0; /* return value does not matter */
1409}
1410
1411
1412/*
1413 * errdetail_internal --- add a detail error message text to the current error
1414 *
1415 * This is exactly like errdetail() except that strings passed to
1416 * errdetail_internal are not translated, and are customarily left out of the
1417 * internationalization message dictionary. This should be used for detail
1418 * messages that seem not worth translating for one reason or another
1419 * (typically, that they don't seem to be useful to average users).
1420 */
1421int
1422errdetail_internal(const char *fmt,...)
1423{
1425 MemoryContext oldcontext;
1426
1429 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1430
1431 EVALUATE_MESSAGE(edata->domain, detail, false, false);
1432
1433 MemoryContextSwitchTo(oldcontext);
1435 return 0; /* return value does not matter */
1436}
1437
1438
1439/*
1440 * errdetail_log --- add a detail_log error message text to the current error
1441 */
1442int
1443errdetail_log(const char *fmt,...)
1444{
1446 MemoryContext oldcontext;
1447
1450 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1451
1452 EVALUATE_MESSAGE(edata->domain, detail_log, false, true);
1453
1454 MemoryContextSwitchTo(oldcontext);
1456 return 0; /* return value does not matter */
1457}
1458
1459/*
1460 * errdetail_log_plural --- add a detail_log error message text to the current error
1461 * with support for pluralization of the message text
1462 */
1463int
1464errdetail_log_plural(const char *fmt_singular, const char *fmt_plural,
1465 unsigned long n,...)
1466{
1468 MemoryContext oldcontext;
1469
1472 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1473
1474 EVALUATE_MESSAGE_PLURAL(edata->domain, detail_log, false);
1475
1476 MemoryContextSwitchTo(oldcontext);
1478 return 0; /* return value does not matter */
1479}
1480
1481
1482/*
1483 * errdetail_plural --- add a detail error message text to the current error,
1484 * with support for pluralization of the message text
1485 */
1486int
1487errdetail_plural(const char *fmt_singular, const char *fmt_plural,
1488 unsigned long n,...)
1489{
1491 MemoryContext oldcontext;
1492
1495 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1496
1497 EVALUATE_MESSAGE_PLURAL(edata->domain, detail, false);
1498
1499 MemoryContextSwitchTo(oldcontext);
1501 return 0; /* return value does not matter */
1502}
1503
1504
1505/*
1506 * errhint --- add a hint error message text to the current error
1507 */
1508int
1509errhint(const char *fmt,...)
1510{
1512 MemoryContext oldcontext;
1513
1516 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1517
1518 EVALUATE_MESSAGE(edata->domain, hint, false, true);
1519
1520 MemoryContextSwitchTo(oldcontext);
1522 return 0; /* return value does not matter */
1523}
1524
1525/*
1526 * errhint_internal --- add a hint error message text to the current error
1527 *
1528 * Non-translated version of errhint(), see also errmsg_internal().
1529 */
1530int
1531errhint_internal(const char *fmt,...)
1532{
1534 MemoryContext oldcontext;
1535
1538 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1539
1540 EVALUATE_MESSAGE(edata->domain, hint, false, false);
1541
1542 MemoryContextSwitchTo(oldcontext);
1544 return 0; /* return value does not matter */
1545}
1546
1547/*
1548 * errhint_plural --- add a hint error message text to the current error,
1549 * with support for pluralization of the message text
1550 */
1551int
1552errhint_plural(const char *fmt_singular, const char *fmt_plural,
1553 unsigned long n,...)
1554{
1556 MemoryContext oldcontext;
1557
1560 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1561
1562 EVALUATE_MESSAGE_PLURAL(edata->domain, hint, false);
1563
1564 MemoryContextSwitchTo(oldcontext);
1566 return 0; /* return value does not matter */
1567}
1568
1569
1570/*
1571 * errcontext_msg --- add a context error message text to the current error
1572 *
1573 * Unlike other cases, multiple calls are allowed to build up a stack of
1574 * context information. We assume earlier calls represent more-closely-nested
1575 * states.
1576 */
1577int
1578errcontext_msg(const char *fmt,...)
1579{
1581 MemoryContext oldcontext;
1582
1585 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1586
1587 EVALUATE_MESSAGE(edata->context_domain, context, true, true);
1588
1589 MemoryContextSwitchTo(oldcontext);
1591 return 0; /* return value does not matter */
1592}
1593
1594/*
1595 * set_errcontext_domain --- set message domain to be used by errcontext()
1596 *
1597 * errcontext_msg() can be called from a different module than the original
1598 * ereport(), so we cannot use the message domain passed in errstart() to
1599 * translate it. Instead, each errcontext_msg() call should be preceded by
1600 * a set_errcontext_domain() call to specify the domain. This is usually
1601 * done transparently by the errcontext() macro.
1602 */
1603int
1604set_errcontext_domain(const char *domain)
1605{
1607
1608 /* we don't bother incrementing recursion_depth */
1610
1611 /* the default text domain is the backend's */
1612 edata->context_domain = domain ? domain : PG_TEXTDOMAIN("postgres");
1613
1614 return 0; /* return value does not matter */
1615}
1616
1617
1618/*
1619 * errhidestmt --- optionally suppress STATEMENT: field of log entry
1620 *
1621 * This should be called if the message text already includes the statement.
1622 */
1623int
1624errhidestmt(bool hide_stmt)
1625{
1627
1628 /* we don't bother incrementing recursion_depth */
1630
1631 edata->hide_stmt = hide_stmt;
1632
1633 return 0; /* return value does not matter */
1634}
1635
1636/*
1637 * errhidecontext --- optionally suppress CONTEXT: field of log entry
1638 *
1639 * This should only be used for verbose debugging messages where the repeated
1640 * inclusion of context would bloat the log volume too much.
1641 */
1642int
1643errhidecontext(bool hide_ctx)
1644{
1646
1647 /* we don't bother incrementing recursion_depth */
1649
1650 edata->hide_ctx = hide_ctx;
1651
1652 return 0; /* return value does not matter */
1653}
1654
1655/*
1656 * errposition --- add cursor position to the current error
1657 */
1658int
1659errposition(int cursorpos)
1660{
1662
1663 /* we don't bother incrementing recursion_depth */
1665
1666 edata->cursorpos = cursorpos;
1667
1668 return 0; /* return value does not matter */
1669}
1670
1671/*
1672 * internalerrposition --- add internal cursor position to the current error
1673 */
1674int
1675internalerrposition(int cursorpos)
1676{
1678
1679 /* we don't bother incrementing recursion_depth */
1681
1682 edata->internalpos = cursorpos;
1683
1684 return 0; /* return value does not matter */
1685}
1686
1687/*
1688 * internalerrquery --- add internal query text to the current error
1689 *
1690 * Can also pass NULL to drop the internal query text entry. This case
1691 * is intended for use in error callback subroutines that are editorializing
1692 * on the layout of the error report.
1693 */
1694int
1695internalerrquery(const char *query)
1696{
1698
1699 /* we don't bother incrementing recursion_depth */
1701
1702 if (edata->internalquery)
1703 {
1704 pfree(edata->internalquery);
1705 edata->internalquery = NULL;
1706 }
1707
1708 if (query)
1709 edata->internalquery = MemoryContextStrdup(edata->assoc_context, query);
1710
1711 return 0; /* return value does not matter */
1712}
1713
1714/*
1715 * err_generic_string -- used to set individual ErrorData string fields
1716 * identified by PG_DIAG_xxx codes.
1717 *
1718 * This intentionally only supports fields that don't use localized strings,
1719 * so that there are no translation considerations.
1720 *
1721 * Most potential callers should not use this directly, but instead prefer
1722 * higher-level abstractions, such as errtablecol() (see relcache.c).
1723 */
1724int
1725err_generic_string(int field, const char *str)
1726{
1728
1729 /* we don't bother incrementing recursion_depth */
1731
1732 switch (field)
1733 {
1735 set_errdata_field(edata->assoc_context, &edata->schema_name, str);
1736 break;
1737 case PG_DIAG_TABLE_NAME:
1738 set_errdata_field(edata->assoc_context, &edata->table_name, str);
1739 break;
1741 set_errdata_field(edata->assoc_context, &edata->column_name, str);
1742 break;
1744 set_errdata_field(edata->assoc_context, &edata->datatype_name, str);
1745 break;
1747 set_errdata_field(edata->assoc_context, &edata->constraint_name, str);
1748 break;
1749 default:
1750 elog(ERROR, "unsupported ErrorData field id: %d", field);
1751 break;
1752 }
1753
1754 return 0; /* return value does not matter */
1755}
1756
1757/*
1758 * set_errdata_field --- set an ErrorData string field
1759 */
1760static void
1761set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str)
1762{
1763 Assert(*ptr == NULL);
1764 *ptr = MemoryContextStrdup(cxt, str);
1765}
1766
1767/*
1768 * geterrcode --- return the currently set SQLSTATE error code
1769 *
1770 * This is only intended for use in error callback subroutines, since there
1771 * is no other place outside elog.c where the concept is meaningful.
1772 */
1773int
1774geterrcode(void)
1775{
1777
1778 /* we don't bother incrementing recursion_depth */
1780
1781 return edata->sqlerrcode;
1782}
1783
1784/*
1785 * geterrposition --- return the currently set error position (0 if none)
1786 *
1787 * This is only intended for use in error callback subroutines, since there
1788 * is no other place outside elog.c where the concept is meaningful.
1789 */
1790int
1791geterrposition(void)
1792{
1794
1795 /* we don't bother incrementing recursion_depth */
1797
1798 return edata->cursorpos;
1799}
1800
1801/*
1802 * getinternalerrposition --- same for internal error position
1803 *
1804 * This is only intended for use in error callback subroutines, since there
1805 * is no other place outside elog.c where the concept is meaningful.
1806 */
1807int
1809{
1811
1812 /* we don't bother incrementing recursion_depth */
1814
1815 return edata->internalpos;
1816}
static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str)
#define EVALUATE_MESSAGE_PLURAL(domain, targetfield, appendval)
Definition elog.c:1049
int getinternalerrposition(void)
int int errhidestmt(bool hide_stmt)
int err_generic_string(int field, const char *str)
int int errdetail_internal(const char *fmt,...) pg_attribute_printf(1
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)
int geterrcode(void)
int errdetail(const char *fmt,...) pg_attribute_printf(1
int int int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1
int errcontext_msg(const char *fmt,...) pg_attribute_printf(1
int errhidecontext(bool hide_ctx)
int int int errdetail_log(const char *fmt,...) pg_attribute_printf(1
int geterrposition(void)
#define elog(elevel,...)
Definition elog.h:228
int errposition(int cursorpos)
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)
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
char * MemoryContextStrdup(MemoryContext context, const char *string)
Definition mcxt.c:1768

Referenced by _bt_compare_array_elements(), _bt_end_vacuum_callback(), _bt_mkscankey(), _SPI_error_callback(), accesstype_arg_to_string(), accumArrayResultArr(), add_one(), add_one_float8(), add_tablespace_mapping(), adjacent_cmp_bounds(), adjacent_inner_consistent(), adjust_group_pathkeys_for_groupagg(), advance_windowaggregate(), advance_windowaggregate_base(), AggRegisterCallback(), apply_extension_options(), applyRelabelType(), archive_close_connection(), array_append_support(), array_prepend_support(), ATColumnChangeRequiresRewrite(), auto_mem_destructor(), AuxiliaryProcKill(), bcTruelen(), before_shmem_exit(), binaryheap_allocate(), bind_param_error_callback(), bit(), bit_bit_count(), bitlength(), bitnot(), bitoctetlength(), bitshiftleft(), bitshiftright(), bitsubstring(), bittoint4(), bittoint8(), booltestsel(), boolvarsel(), bound_cmp(), bpcharlen(), bpcharoctetlen(), bsearch_arg(), build_subplan(), CacheRegisterRelcacheCallback(), CacheRegisterRelSyncCallback(), CacheRegisterSyscacheCallback(), cancel_before_shmem_exit(), cancel_on_dsm_detach(), chr(), clause_is_strict_for(), clause_selectivity_ext(), cleanup_background_workers(), CleanupInvalidationState(), cmpEntries(), cmpEntryAccumulator(), coerce_record_to_complex(), coerce_to_domain(), coerce_to_target_type(), compare_expanded_ranges(), compare_scalars(), compare_scalars_simple(), compare_values(), compareentry(), compareQueryOperand(), comparetup_cluster_tiebreak(), comparetup_index_btree_tiebreak(), comparetup_index_hash(), ComputeIndexAttrs(), ComputePartitionAttrs(), contain_nonstrict_functions_walker(), conversion_error_callback(), convert_and_check_filename(), CopyFromErrorCallback(), createdb_failure_callback(), daitch_mokotoff(), DataChecksumsWorkerMain(), dccref_deletion_callback(), decrypt_init(), defaultNoticeProcessor(), defaultNoticeReceiver(), deparseAggref(), deparseFuncExpr(), descriptor_destructor(), dmetaphone(), dmetaphone_alt(), do_pg_abort_backup(), dshash_attach(), dshash_create(), dsm_detach(), dsm_postmaster_shutdown(), dumpLOs(), ec_member_matches_foreign(), ec_member_matches_indexcol(), ecpg_sqlca_key_destructor(), ECPGnoticeReceiver(), element_compare(), entryIndexByFrequencyCmp(), enum_known_sorted(), ER_mc_callback(), eval_const_expressions_mutator(), evaluate_function(), examine_opclause_args(), examine_variable(), ExecBuildAggTrans(), ExecEvalFuncArgs(), ExecEvalXmlExpr(), ExecIndexBuildScanKeys(), ExecInitExprRec(), ExecInitFunc(), ExecInitSubPlanExpr(), ExecuteDoStmt(), exp_var(), expand_function_arguments(), expr_is_nonnullable(), exprCollation(), expression_tree_walker_impl(), exprIsNullConstant(), exprLocation(), exprSetCollation(), exprType(), exprTypmod(), extract_jsp_bool_expr(), extract_jsp_path_expr_nodes(), FigureColnameInternal(), find_duplicate_ors(), find_enumitem(), find_param_referent(), find_window_run_conditions(), fix_indexqual_operand(), flatten_set_variable_args(), flattenJsonPathParseItem(), float4up(), float8up(), fn(), fn(), freestate_cluster(), gbt_vsrt_cmp(), gen_partprune_steps_internal(), get_agg_expr_helper(), get_call_expr_arg_stable(), get_cast_hashentry(), get_coercion_expr(), get_func_expr(), get_oper_expr(), get_rule_expr(), get_stats_option_name(), get_windowfunc_expr_helper(), GetNamedDSMSegment(), ginAllocEntryAccumulator(), ginCombineData(), gincost_opexpr(), gincost_scalararrayopexpr(), ginExtractEntries(), group_similar_or_args(), guc_restore_error_context_callback(), HandleSlashCmds(), heap_compare_slots(), heap_compare_slots(), heap_inplace_lock(), host_context_cleanup_cb(), i8tod(), i8tof(), i8tooid(), ignore_slash_filepipe(), ignore_slash_options(), ignore_slash_whole_line(), import_error_callback(), indexOfColumn(), init_tdr_dsm(), injection_error(), injection_notice(), injection_points_cached(), injection_points_run(), InjectionPointCached(), InjectionPointRun(), inline_function(), int28(), int2um(), int2up(), int48(), int4inc(), int4um(), int4up(), int82(), int84(), int8dec(), int8inc(), int8inc_support(), int8um(), int8up(), interval_cmp_lower(), interval_cmp_upper(), InvalidateTSCacheCallBack(), isort_cmp(), isotesterNoticeProcessor(), isSimpleNode(), IsSquashableConstant(), json_object_agg_transfn_worker(), jsonb_agg_finalfn(), jsonb_object_agg_finalfn(), jspIsMutableWalker(), left_oper(), libpqsrv_notice_receiver(), ln_var(), local_buffer_write_error_callback(), main(), make_nulltest_from_distinct(), makeDefElem(), makeDefElemExtended(), makeRelabelType(), map_field_to_arg(), match_boolean_index_clause(), match_boolean_partition_clause(), match_clause_to_partition_key(), match_eclass_clauses_to_index(), match_eclasses_to_foreign_key_col(), match_expr_to_partition_keys(), match_index_to_operand(), matches_boolean_partition_clause(), mdc_init(), mdcbuf_init(), movedb_failure_callback(), multi_sort_compare(), notice_processor(), NoticeProcessor(), nulltestsel(), numeric_exp(), numeric_inc(), numeric_is_integral(), numeric_ln(), numeric_min_scale(), numeric_round(), numeric_sqrt(), numeric_trunc(), oidtoi8(), oidtooid8(), on_dsm_detach(), on_proc_exit(), on_shmem_exit(), ordered_set_shutdown(), output_plugin_error_callback(), pa_shutdown(), pairingheap_allocate(), pairingheap_GISTSearchItem_cmp(), pairingheap_initialize(), pairingheap_SpGistSearchItem_cmp(), parallel_vacuum_error_callback(), ParallelWorkerShutdown(), paramlist_parser_setup(), ParamsErrorCallback(), ParseFuncOrColumn(), pcb_error_callback(), pg_digest(), pg_hmac(), pg_size_bytes(), pg_snapshot_xip(), pgaio_worker_error_callback(), pgp_pub_decrypt_bytea(), pgp_pub_decrypt_text(), pgp_pub_encrypt_bytea(), pgp_pub_encrypt_text(), pgp_sym_decrypt_bytea(), pgp_sym_decrypt_text(), pgp_sym_encrypt_bytea(), pgp_sym_encrypt_text(), pgstat_cmp_hash_key(), pgstat_hash_hash_key(), plperl_compile_callback(), plperl_exec_callback(), plperl_ref_from_pg_array(), plpgsql_compile_error_callback(), plpgsql_exec_error_callback(), plpgsql_execsql_error_callback(), plpython_error_callback(), plpython_srf_cleanup_callback(), PLy_cursor_plan(), PLy_function_build_args(), PLy_input_convert(), PLy_input_from_tuple(), PLy_input_setup_func(), PLy_input_setup_tuple(), PLy_output_convert(), PLy_output_setup_func(), PLy_output_setup_record(), PLy_output_setup_tuple(), PLy_result_ass_subscript(), PLy_result_item(), PLy_result_length(), PLy_result_str(), PLy_result_subscript(), PLy_spi_execute_plan(), PLyDict_FromComposite(), PLyDict_FromTuple(), PLyGenericObject_ToComposite(), PLyList_FromArray(), PLyMapping_ToComposite(), PLyObject_FromTransform(), PLyObject_ToComposite(), PLyObject_ToDomain(), PLyObject_ToScalar(), PLyObject_ToTransform(), PLySequence_ToArray(), PLySequence_ToComposite(), PLyUnicode_FromScalar(), PLyUnicode_ToComposite(), postgresGetForeignPaths(), PQsetnonblocking(), PQsetNoticeProcessor(), PQsetNoticeReceiver(), prefix_init(), proc_exit_prepare(), process_data_type_check(), process_extension_updates(), process_gist_inet_ops_check(), process_incompat_polymorphics(), process_inconsistent_notnull(), process_isn_and_int8_passing_mismatch(), process_loadable_libraries(), process_matched_tle(), process_old_sub_state_check(), process_unicode_update(), process_user_defined_encoding_conversions(), process_user_defined_postfix_ops(), process_with_oids_check(), pts_error_callback(), pull_ands(), pull_from_mbuf(), pull_ors(), push_into_mbuf(), qsort_partition_list_value_cmp(), qsort_partition_rbound_cmp(), qunique_arg(), quote_postgres(), range_bound_qsort_cmp(), range_compare(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForAttachIndex(), RangeVarCallbackForDblink(), RangeVarCallbackForDropRelation(), RangeVarCallbackForLockTable(), RangeVarCallbackForReindexIndex(), RangeVarCallbackForStats(), raw_expression_tree_walker_impl(), rbt_create(), readtup_cluster(), readtup_index(), RegisterAfterTriggerBatchCallback(), RegisterExprContextCallback(), RegisterResourceReleaseCallback(), RegisterSubXactCallback(), RegisterXactCallback(), REGRESS_object_access_hook(), REGRESS_object_access_hook_str(), reindex_error_callback(), removeabbrev_cluster(), removeabbrev_index(), RemoveSQLFunctionCache(), reorder_function_arguments(), ReorderBufferIterCompare(), reorderqueue_cmp(), RepackWorkerShutdown(), rm_redo_error_callback(), runShellCommand(), scb_error_callback(), script_error_callback(), sepgsql_object_access(), set_option(), set_plan_disabling_options(), shared_buffer_write_error_callback(), shared_record_table_compare(), shared_record_table_hash(), shm_mq_detach_callback(), shmem_exit(), show_tablesample(), shutdown_MultiFuncCall(), ShutdownSetExpr(), ShutdownSQLFunction(), simplify_and_arguments(), simplify_or_arguments(), single_bound_cmp(), slotsync_failure_callback(), slotsync_worker_disconnect(), sort_item_compare(), soundex(), split_selfjoin_quals(), sql_compile_error_callback(), sql_exec_error_callback(), sql_function_parse_error_callback(), sql_inline_error_callback(), sql_postrewrite_callback(), sqrt_var(), start_proc_error_callback(), statext_is_compatible_clause_internal(), strip_array_coercion(), tablesample_init(), tablespace_list_append(), tbm_shared_comparator(), test_custom_rmgrs_insert_wal_record(), test_thread(), text_format(), threadRun(), tokenize_error_callback(), transformAggregateCall(), transformBoolExpr(), transformCaseExpr(), transformFuncCall(), transformJsonArrayAgg(), transformJsonParseExpr(), transformJsonPassingArgs(), transformJsonScalarExpr(), transformJsonSerializeExpr(), transformLabelExpr(), transformRangeFunction(), transformRangeTableSample(), transformTypeCast(), TS_execute(), TS_execute_locations(), TS_execute_locations_recurse(), TS_execute_recurse(), TS_execute_ternary(), TS_phrase_execute(), tsearch_readline_callback(), tuplesort_begin_cluster(), tuplesort_begin_datum(), tuplesort_begin_index_btree(), tuplesort_begin_index_gist(), tuplesort_begin_index_hash(), tuplesort_getdatum(), tuplesort_putdatum(), tuplesort_putheaptuple(), tuplesort_putindextuplevalues(), UnregisterExprContextCallback(), UnregisterResourceReleaseCallback(), UnregisterSubXactCallback(), UnregisterXactCallback(), upgrade_task_add_step(), vacuum_error_callback(), varbit(), waitonlock_error_callback(), WalRcvDie(), writetup_datum(), XactLockTableWaitErrorCb(), xml_is_document(), xmlcomment(), xmlelement(), xmlpi(), and xmltext().

◆ backtrace_function_list

char* backtrace_function_list
static

Definition at line 122 of file elog.c.

Referenced by assign_backtrace_functions(), and matches_backtrace_functions().

◆ emit_log_hook

emit_log_hook_type emit_log_hook = NULL

Definition at line 111 of file elog.c.

Referenced by EmitErrorReport().

◆ error_context_stack

ErrorContextCallback* error_context_stack = NULL

Definition at line 100 of file elog.c.

Referenced by _SPI_execute_plan(), _SPI_prepare_oneshot_plan(), _SPI_prepare_plan(), ApplyWalRecord(), AutoVacLauncherMain(), AutoVacWorkerMain(), BackgroundWorkerMain(), BackgroundWriterMain(), begin_cb_wrapper(), begin_prepare_cb_wrapper(), call_pltcl_start_proc(), cancel_parser_errposition_callback(), cancel_scanner_errposition_callback(), change_cb_wrapper(), CheckpointerMain(), commit_cb_wrapper(), commit_prepared_cb_wrapper(), compile_plperl_function(), CopyFrom(), CreateParallelContext(), errfinish(), errstart(), exec_bind_message(), exec_execute_message(), exec_stmt_execsql(), execute_sql_string(), file_acquire_sample_rows(), fileIterateForeignScan(), filter_by_origin_cb_wrapper(), filter_prepare_cb_wrapper(), FlushBuffer(), FlushRelationBuffers(), fmgr_sql(), fmgr_sql_validator(), GetErrorContextStack(), heap_vacuum_rel(), ImportForeignSchema(), inline_function(), inline_function_in_from(), IoWorkerMain(), LogicalParallelApplyLoop(), LogicalRepApplyLoop(), make_tuple_from_result_row(), message_cb_wrapper(), parallel_vacuum_main(), pg_re_throw(), pgarch_archiveXlog(), plperl_event_trigger_handler(), plperl_func_handler(), plperl_inline_handler(), plperl_trigger_handler(), plpgsql_compile_callback(), plpgsql_compile_inline(), plpgsql_exec_event_trigger(), plpgsql_exec_function(), plpgsql_exec_trigger(), plpython3_call_handler(), plpython3_inline_handler(), PLy_exec_function(), PLy_modify_tuple(), PostgresMain(), prepare_cb_wrapper(), proc_exit_prepare(), ProcessParallelApplyMessage(), ProcessParallelMessage(), quickdie(), ReindexPartitions(), ReplSlotSyncWorkerMain(), RestoreGUCState(), rollback_prepared_cb_wrapper(), setup_parser_errposition_callback(), setup_scanner_errposition_callback(), shutdown_cb_wrapper(), SPI_cursor_open_internal(), SPI_plan_get_cached_plan(), sql_compile_callback(), startup_cb_wrapper(), stream_abort_cb_wrapper(), stream_change_cb_wrapper(), stream_commit_cb_wrapper(), stream_message_cb_wrapper(), stream_prepare_cb_wrapper(), stream_start_cb_wrapper(), stream_stop_cb_wrapper(), stream_truncate_cb_wrapper(), tokenize_auth_file(), truncate_cb_wrapper(), tsearch_readline_begin(), tsearch_readline_end(), typeStringToTypeName(), update_progress_txn_cb_wrapper(), WaitOnLock(), WalSummarizerMain(), WalWriterMain(), and XactLockTableWait().

◆ errordata

◆ errordata_stack_depth

◆ formatted_log_time

char formatted_log_time[FORMATTED_TS_LEN]
static

Definition at line 171 of file elog.c.

Referenced by EmitErrorReport(), get_formatted_log_time(), and log_status_format().

◆ formatted_start_time

char formatted_start_time[FORMATTED_TS_LEN]
static

Definition at line 170 of file elog.c.

Referenced by get_formatted_start_time(), and reset_formatted_start_time().

◆ Log_destination

◆ Log_destination_string

char* Log_destination_string = NULL

Definition at line 117 of file elog.c.

Referenced by PostmasterMain().

◆ Log_error_verbosity

int Log_error_verbosity = PGERROR_DEFAULT

Definition at line 114 of file elog.c.

Referenced by send_message_to_server_log(), write_csvlog(), and write_jsonlog().

◆ Log_line_prefix

char* Log_line_prefix = NULL

Definition at line 115 of file elog.c.

Referenced by log_line_prefix().

◆ PG_exception_stack

◆ recursion_depth

◆ save_format_domain

const char* save_format_domain
static

Definition at line 1838 of file elog.c.

Referenced by format_elog_string(), and pre_format_elog_string().

◆ saved_timeval

struct timeval saved_timeval
static

Definition at line 166 of file elog.c.

Referenced by get_formatted_log_time(), and log_status_format().

◆ saved_timeval_set

bool saved_timeval_set = false
static

Definition at line 167 of file elog.c.

Referenced by EmitErrorReport(), get_formatted_log_time(), and log_status_format().

◆ syslog_sequence_numbers

bool syslog_sequence_numbers = true

Definition at line 118 of file elog.c.

◆ syslog_split_messages

bool syslog_split_messages = true

Definition at line 119 of file elog.c.