PostgreSQL Source Code git master
elog.h File Reference
#include <setjmp.h>
#include "lib/stringinfo.h"
#include "utils/errcodes.h"
Include dependency graph for elog.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ErrorContextCallback
 
struct  ErrorData
 

Macros

#define DEBUG5
 
#define DEBUG4   11
 
#define DEBUG3   12
 
#define DEBUG2   13
 
#define DEBUG1   14 /* used by GUC debug_* variables */
 
#define LOG
 
#define LOG_SERVER_ONLY
 
#define COMMERROR
 
#define INFO
 
#define NOTICE
 
#define WARNING
 
#define PGWARNING   19 /* Must equal WARNING; see NOTE below. */
 
#define WARNING_CLIENT_ONLY
 
#define ERROR
 
#define PGERROR   21 /* Must equal ERROR; see NOTE below. */
 
#define FATAL   22 /* fatal error - abort process */
 
#define PANIC   23 /* take down the other backends with me */
 
#define PGSIXBIT(ch)   (((ch) - '0') & 0x3F)
 
#define PGUNSIXBIT(val)   (((val) & 0x3F) + '0')
 
#define MAKE_SQLSTATE(ch1, ch2, ch3, ch4, ch5)
 
#define ERRCODE_TO_CATEGORY(ec)   ((ec) & ((1 << 12) - 1))
 
#define ERRCODE_IS_CATEGORY(ec)   (((ec) & ~((1 << 12) - 1)) == 0)
 
#define pg_prevent_errno_in_scope()
 
#define ereport_domain(elevel, domain, ...)
 
#define ereport(elevel, ...)    ereport_domain(elevel, TEXTDOMAIN, __VA_ARGS__)
 
#define TEXTDOMAIN   NULL
 
#define errcontext   set_errcontext_domain(TEXTDOMAIN), errcontext_msg
 
#define elog(elevel, ...)    ereport(elevel, errmsg_internal(__VA_ARGS__))
 
#define errsave_domain(context, domain, ...)
 
#define errsave(context, ...)    errsave_domain(context, TEXTDOMAIN, __VA_ARGS__)
 
#define ereturn_domain(context, dummy_value, domain, ...)
 
#define ereturn(context, dummy_value, ...)    ereturn_domain(context, dummy_value, TEXTDOMAIN, __VA_ARGS__)
 
#define PG_TRY(...)
 
#define PG_CATCH(...)
 
#define PG_FINALLY(...)
 
#define PG_END_TRY(...)
 
#define PG_RE_THROW()    pg_re_throw()
 
#define LOG_DESTINATION_STDERR   1
 
#define LOG_DESTINATION_SYSLOG   2
 
#define LOG_DESTINATION_EVENTLOG   4
 
#define LOG_DESTINATION_CSVLOG   8
 
#define LOG_DESTINATION_JSONLOG   16
 

Typedefs

typedef char struct ErrorContextCallback ErrorContextCallback
 
typedef struct ErrorData ErrorData
 
typedef void(* emit_log_hook_type) (ErrorData *edata)
 

Enumerations

enum  PGErrorVerbosity { PGERROR_TERSE , PGERROR_DEFAULT , PGERROR_VERBOSE }
 

Functions

bool message_level_is_interesting (int elevel)
 
bool errstart (int elevel, const char *domain)
 
pg_attribute_cold bool errstart_cold (int elevel, const char *domain)
 
void errfinish (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,...) pg_attribute_printf(1
 
int int errmsg_internal (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 int int pg_attribute_printf (2, 4)
 
int errdetail (const char *fmt,...) pg_attribute_printf(1
 
int int errdetail_internal (const char *fmt,...) pg_attribute_printf(1
 
int int int errdetail_log (const char *fmt,...) pg_attribute_printf(1
 
int int int int errdetail_log_plural (const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1
 
int errdetail_plural (const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1
 
int errhint (const char *fmt,...) pg_attribute_printf(1
 
int int errhint_internal (const char *fmt,...) pg_attribute_printf(1
 
int int int errhint_plural (const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1
 
int set_errcontext_domain (const char *domain)
 
int errcontext_msg (const char *fmt,...) pg_attribute_printf(1
 
int int errhidestmt (bool hide_stmt)
 
int errhidecontext (bool hide_ctx)
 
int errbacktrace (void)
 
int errposition (int cursorpos)
 
int internalerrposition (int cursorpos)
 
int internalerrquery (const char *query)
 
int err_generic_string (int field, const char *str)
 
int geterrcode (void)
 
int geterrposition (void)
 
int getinternalerrposition (void)
 
bool errsave_start (struct Node *context, const char *domain)
 
void errsave_finish (struct Node *context, const char *filename, int lineno, const char *funcname)
 
void pre_format_elog_string (int errnumber, const char *domain)
 
char * format_elog_string (const char *fmt,...) pg_attribute_printf(1
 
void EmitErrorReport (void)
 
ErrorDataCopyErrorData (void)
 
void FreeErrorData (ErrorData *edata)
 
void FlushErrorState (void)
 
pg_noreturn void ReThrowError (ErrorData *edata)
 
void ThrowErrorData (ErrorData *edata)
 
pg_noreturn void pg_re_throw (void)
 
char * GetErrorContextStack (void)
 
void log_status_format (StringInfo buf, const char *format, ErrorData *edata)
 
void DebugFileOpen (void)
 
char * unpack_sql_state (int sql_state)
 
bool in_error_recursion_trouble (void)
 
void reset_formatted_start_time (void)
 
char * get_formatted_start_time (void)
 
char * get_formatted_log_time (void)
 
const char * get_backend_type_for_log (void)
 
bool check_log_of_query (ErrorData *edata)
 
const char * error_severity (int elevel)
 
void write_pipe_chunks (char *data, int len, int dest)
 
void write_csvlog (ErrorData *edata)
 
void write_jsonlog (ErrorData *edata)
 
void write_stderr (const char *fmt,...) pg_attribute_printf(1
 
void void vwrite_stderr (const char *fmt, va_list ap) pg_attribute_printf(1
 

Variables

PGDLLIMPORT ErrorContextCallbackerror_context_stack
 
PGDLLIMPORT sigjmp_buf * PG_exception_stack
 
PGDLLIMPORT emit_log_hook_type emit_log_hook
 
PGDLLIMPORT int Log_error_verbosity
 
PGDLLIMPORT char * Log_line_prefix
 
PGDLLIMPORT int Log_destination
 
PGDLLIMPORT char * Log_destination_string
 
PGDLLIMPORT bool syslog_sequence_numbers
 
PGDLLIMPORT bool syslog_split_messages
 

Macro Definition Documentation

◆ COMMERROR

#define COMMERROR
Value:
LOG_SERVER_ONLY /* Client communication problems; same as
* LOG for server reporting, but never
* sent to client. */
#define LOG_SERVER_ONLY
Definition: elog.h:32

Definition at line 33 of file elog.h.

◆ DEBUG1

#define DEBUG1   14 /* used by GUC debug_* variables */

Definition at line 30 of file elog.h.

◆ DEBUG2

#define DEBUG2   13

Definition at line 29 of file elog.h.

◆ DEBUG3

#define DEBUG3   12

Definition at line 28 of file elog.h.

◆ DEBUG4

#define DEBUG4   11

Definition at line 27 of file elog.h.

◆ DEBUG5

#define DEBUG5
Value:
10 /* Debugging messages, in categories of
* decreasing detail. */

Definition at line 26 of file elog.h.

◆ elog

#define elog (   elevel,
  ... 
)     ereport(elevel, errmsg_internal(__VA_ARGS__))

Definition at line 226 of file elog.h.

◆ ereport

#define ereport (   elevel,
  ... 
)     ereport_domain(elevel, TEXTDOMAIN, __VA_ARGS__)

Definition at line 150 of file elog.h.

◆ ereport_domain

#define ereport_domain (   elevel,
  domain,
  ... 
)
Value:
do { \
const int elevel_ = (elevel); \
pg_prevent_errno_in_scope(); \
if (errstart(elevel_, domain)) \
__VA_ARGS__, errfinish(__FILE__, __LINE__, __func__); \
if (elevel_ >= ERROR) \
pg_unreachable(); \
} while(0)
bool errstart(int elevel, const char *domain)
Definition: elog.c:343
#define ERROR
Definition: elog.h:39
void errfinish(const char *filename, int lineno, const char *funcname)
Definition: elog.c:474

Definition at line 139 of file elog.h.

◆ ereturn

#define ereturn (   context,
  dummy_value,
  ... 
)     ereturn_domain(context, dummy_value, TEXTDOMAIN, __VA_ARGS__)

Definition at line 278 of file elog.h.

◆ ereturn_domain

#define ereturn_domain (   context,
  dummy_value,
  domain,
  ... 
)
Value:
do { \
errsave_domain(context, domain, __VA_ARGS__); \
return dummy_value; \
} while(0)

Definition at line 272 of file elog.h.

◆ ERRCODE_IS_CATEGORY

#define ERRCODE_IS_CATEGORY (   ec)    (((ec) & ~((1 << 12) - 1)) == 0)

Definition at line 62 of file elog.h.

◆ ERRCODE_TO_CATEGORY

#define ERRCODE_TO_CATEGORY (   ec)    ((ec) & ((1 << 12) - 1))

Definition at line 61 of file elog.h.

◆ errcontext

#define errcontext   set_errcontext_domain(TEXTDOMAIN), errcontext_msg

Definition at line 198 of file elog.h.

◆ ERROR

#define ERROR
Value:
21 /* user error - abort transaction; return to
* known state */

Definition at line 39 of file elog.h.

◆ errsave

#define errsave (   context,
  ... 
)     errsave_domain(context, TEXTDOMAIN, __VA_ARGS__)

Definition at line 262 of file elog.h.

◆ errsave_domain

#define errsave_domain (   context,
  domain,
  ... 
)
Value:
do { \
struct Node *context_ = (context); \
pg_prevent_errno_in_scope(); \
if (errsave_start(context_, domain)) \
__VA_ARGS__, errsave_finish(context_, __FILE__, __LINE__, __func__); \
} while(0)
bool errsave_start(struct Node *context, const char *domain)
Definition: elog.c:639
void errsave_finish(struct Node *context, const char *filename, int lineno, const char *funcname)
Definition: elog.c:691
Definition: nodes.h:135

Definition at line 254 of file elog.h.

◆ FATAL

#define FATAL   22 /* fatal error - abort process */

Definition at line 41 of file elog.h.

◆ INFO

#define INFO
Value:
17 /* Messages specifically requested by user (eg
* VACUUM VERBOSE output); always sent to
* client regardless of client_min_messages,
* but by default not sent to server log. */

Definition at line 34 of file elog.h.

◆ LOG

#define LOG
Value:
15 /* Server operational messages; sent only to
* server log by default. */

Definition at line 31 of file elog.h.

◆ LOG_DESTINATION_CSVLOG

#define LOG_DESTINATION_CSVLOG   8

Definition at line 488 of file elog.h.

◆ LOG_DESTINATION_EVENTLOG

#define LOG_DESTINATION_EVENTLOG   4

Definition at line 487 of file elog.h.

◆ LOG_DESTINATION_JSONLOG

#define LOG_DESTINATION_JSONLOG   16

Definition at line 489 of file elog.h.

◆ LOG_DESTINATION_STDERR

#define LOG_DESTINATION_STDERR   1

Definition at line 485 of file elog.h.

◆ LOG_DESTINATION_SYSLOG

#define LOG_DESTINATION_SYSLOG   2

Definition at line 486 of file elog.h.

◆ LOG_SERVER_ONLY

#define LOG_SERVER_ONLY
Value:
16 /* Same as LOG for server reporting, but never
* sent to client. */

Definition at line 32 of file elog.h.

◆ MAKE_SQLSTATE

#define MAKE_SQLSTATE (   ch1,
  ch2,
  ch3,
  ch4,
  ch5 
)
Value:
(PGSIXBIT(ch1) + (PGSIXBIT(ch2) << 6) + (PGSIXBIT(ch3) << 12) + \
(PGSIXBIT(ch4) << 18) + (PGSIXBIT(ch5) << 24))
#define PGSIXBIT(ch)
Definition: elog.h:53

Definition at line 56 of file elog.h.

◆ NOTICE

#define NOTICE
Value:
18 /* Helpful messages to users about query
* operation; sent to client and not to server
* log by default. */

Definition at line 35 of file elog.h.

◆ PANIC

#define PANIC   23 /* take down the other backends with me */

Definition at line 42 of file elog.h.

◆ PG_CATCH

#define PG_CATCH (   ...)
Value:
} \
else \
{ \
PG_exception_stack = _save_exception_stack##__VA_ARGS__; \
error_context_stack = _save_context_stack##__VA_ARGS__

Definition at line 382 of file elog.h.

◆ PG_END_TRY

#define PG_END_TRY (   ...)
Value:
} \
if (_do_rethrow##__VA_ARGS__) \
PG_RE_THROW(); \
PG_exception_stack = _save_exception_stack##__VA_ARGS__; \
error_context_stack = _save_context_stack##__VA_ARGS__; \
} while (0)

Definition at line 397 of file elog.h.

◆ PG_FINALLY

#define PG_FINALLY (   ...)
Value:
} \
else \
_do_rethrow##__VA_ARGS__ = true; \
{ \
PG_exception_stack = _save_exception_stack##__VA_ARGS__; \
error_context_stack = _save_context_stack##__VA_ARGS__

Definition at line 389 of file elog.h.

◆ pg_prevent_errno_in_scope

#define pg_prevent_errno_in_scope ( )

Definition at line 81 of file elog.h.

◆ PG_RE_THROW

#define PG_RE_THROW ( )     pg_re_throw()

Definition at line 405 of file elog.h.

◆ PG_TRY

#define PG_TRY (   ...)
Value:
do { \
sigjmp_buf *_save_exception_stack##__VA_ARGS__ = PG_exception_stack; \
ErrorContextCallback *_save_context_stack##__VA_ARGS__ = error_context_stack; \
sigjmp_buf _local_sigjmp_buf##__VA_ARGS__; \
bool _do_rethrow##__VA_ARGS__ = false; \
if (sigsetjmp(_local_sigjmp_buf##__VA_ARGS__, 0) == 0) \
{ \
PG_exception_stack = &_local_sigjmp_buf##__VA_ARGS__
PGDLLIMPORT sigjmp_buf * PG_exception_stack
Definition: elog.c:97
PGDLLIMPORT ErrorContextCallback * error_context_stack
Definition: elog.c:95

Definition at line 372 of file elog.h.

◆ PGERROR

#define PGERROR   21 /* Must equal ERROR; see NOTE below. */

Definition at line 40 of file elog.h.

◆ PGSIXBIT

#define PGSIXBIT (   ch)    (((ch) - '0') & 0x3F)

Definition at line 53 of file elog.h.

◆ PGUNSIXBIT

#define PGUNSIXBIT (   val)    (((val) & 0x3F) + '0')

Definition at line 54 of file elog.h.

◆ PGWARNING

#define PGWARNING   19 /* Must equal WARNING; see NOTE below. */

Definition at line 37 of file elog.h.

◆ TEXTDOMAIN

#define TEXTDOMAIN   NULL

Definition at line 153 of file elog.h.

◆ WARNING

#define WARNING
Value:
19 /* Warnings. NOTICE is for expected messages
* like implicit sequence creation by SERIAL.
* WARNING is for unexpected messages. */

Definition at line 36 of file elog.h.

◆ WARNING_CLIENT_ONLY

#define WARNING_CLIENT_ONLY
Value:
20 /* Warnings to be sent to client as usual, but
* never to the server log. */

Definition at line 38 of file elog.h.

Typedef Documentation

◆ emit_log_hook_type

typedef void(* emit_log_hook_type) (ErrorData *edata)

Definition at line 464 of file elog.h.

◆ ErrorContextCallback

◆ ErrorData

typedef struct ErrorData ErrorData

Enumeration Type Documentation

◆ PGErrorVerbosity

Enumerator
PGERROR_TERSE 
PGERROR_DEFAULT 
PGERROR_VERBOSE 

Definition at line 470 of file elog.h.

485{

Function Documentation

◆ check_log_of_query()

bool check_log_of_query ( ErrorData edata)

Definition at line 2752 of file elog.c.

2753{
2754 /* log required? */
2756 return false;
2757
2758 /* query log wanted? */
2759 if (edata->hide_stmt)
2760 return false;
2761
2762 /* query string available? */
2763 if (debug_query_string == NULL)
2764 return false;
2765
2766 return true;
2767}
static bool is_log_level_output(int elevel, int log_min_level)
Definition: elog.c:202
int log_min_error_statement
Definition: guc_tables.c:539
const char * debug_query_string
Definition: postgres.c:89
int elevel
Definition: elog.h:421
bool hide_stmt
Definition: elog.h:424

References debug_query_string, ErrorData::elevel, ErrorData::hide_stmt, 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 1763 of file elog.c.

1764{
1766 ErrorData *newedata;
1767
1768 /*
1769 * we don't increment recursion_depth because out-of-memory here does not
1770 * indicate a problem within the error subsystem.
1771 */
1773
1775
1776 /* Copy the struct itself */
1777 newedata = (ErrorData *) palloc(sizeof(ErrorData));
1778 memcpy(newedata, edata, sizeof(ErrorData));
1779
1780 /*
1781 * Make copies of separately-allocated strings. Note that we copy even
1782 * theoretically-constant strings such as filename. This is because those
1783 * could point into JIT-created code segments that might get unloaded at
1784 * transaction cleanup. In some cases we need the copied ErrorData to
1785 * survive transaction boundaries, so we'd better copy those strings too.
1786 */
1787 if (newedata->filename)
1788 newedata->filename = pstrdup(newedata->filename);
1789 if (newedata->funcname)
1790 newedata->funcname = pstrdup(newedata->funcname);
1791 if (newedata->domain)
1792 newedata->domain = pstrdup(newedata->domain);
1793 if (newedata->context_domain)
1794 newedata->context_domain = pstrdup(newedata->context_domain);
1795 if (newedata->message)
1796 newedata->message = pstrdup(newedata->message);
1797 if (newedata->detail)
1798 newedata->detail = pstrdup(newedata->detail);
1799 if (newedata->detail_log)
1800 newedata->detail_log = pstrdup(newedata->detail_log);
1801 if (newedata->hint)
1802 newedata->hint = pstrdup(newedata->hint);
1803 if (newedata->context)
1804 newedata->context = pstrdup(newedata->context);
1805 if (newedata->backtrace)
1806 newedata->backtrace = pstrdup(newedata->backtrace);
1807 if (newedata->message_id)
1808 newedata->message_id = pstrdup(newedata->message_id);
1809 if (newedata->schema_name)
1810 newedata->schema_name = pstrdup(newedata->schema_name);
1811 if (newedata->table_name)
1812 newedata->table_name = pstrdup(newedata->table_name);
1813 if (newedata->column_name)
1814 newedata->column_name = pstrdup(newedata->column_name);
1815 if (newedata->datatype_name)
1816 newedata->datatype_name = pstrdup(newedata->datatype_name);
1817 if (newedata->constraint_name)
1818 newedata->constraint_name = pstrdup(newedata->constraint_name);
1819 if (newedata->internalquery)
1820 newedata->internalquery = pstrdup(newedata->internalquery);
1821
1822 /* Use the calling context for string allocation */
1824
1825 return newedata;
1826}
static int errordata_stack_depth
Definition: elog.c:148
#define CHECK_STACK_DEPTH()
Definition: elog.c:165
static ErrorData errordata[ERRORDATA_STACK_SIZE]
Definition: elog.c:146
Assert(PointerIsAligned(start, uint64))
char * pstrdup(const char *in)
Definition: mcxt.c:1759
void * palloc(Size size)
Definition: mcxt.c:1365
MemoryContext CurrentMemoryContext
Definition: mcxt.c:160
MemoryContext ErrorContext
Definition: mcxt.c:167
char * schema_name
Definition: elog.h:439
char * context
Definition: elog.h:436
const char * domain
Definition: elog.h:429
char * internalquery
Definition: elog.h:446
struct MemoryContextData * assoc_context
Definition: elog.h:450
const char * filename
Definition: elog.h:426
char * datatype_name
Definition: elog.h:442
char * detail
Definition: elog.h:433
const char * context_domain
Definition: elog.h:430
const char * funcname
Definition: elog.h:428
char * table_name
Definition: elog.h:440
char * backtrace
Definition: elog.h:437
char * message
Definition: elog.h:432
char * detail_log
Definition: elog.h:434
const char * message_id
Definition: elog.h:438
char * hint
Definition: elog.h:435
char * constraint_name
Definition: elog.h:443
char * column_name
Definition: elog.h:441

References Assert(), ErrorData::assoc_context, ErrorData::backtrace, CHECK_STACK_DEPTH, ErrorData::column_name, ErrorData::constraint_name, ErrorData::context, ErrorData::context_domain, CurrentMemoryContext, ErrorData::datatype_name, ErrorData::detail, ErrorData::detail_log, ErrorData::domain, ErrorContext, errordata, errordata_stack_depth, ErrorData::filename, ErrorData::funcname, ErrorData::hint, ErrorData::internalquery, ErrorData::message, ErrorData::message_id, palloc(), pstrdup(), ErrorData::schema_name, and ErrorData::table_name.

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 2128 of file elog.c.

2129{
2130 int fd,
2131 istty;
2132
2133 if (OutputFileName[0])
2134 {
2135 /*
2136 * A debug-output file name was given.
2137 *
2138 * Make sure we can write the file, and find out if it's a tty.
2139 */
2140 if ((fd = open(OutputFileName, O_CREAT | O_APPEND | O_WRONLY,
2141 0666)) < 0)
2142 ereport(FATAL,
2144 errmsg("could not open file \"%s\": %m", OutputFileName)));
2145 istty = isatty(fd);
2146 close(fd);
2147
2148 /*
2149 * Redirect our stderr to the debug output file.
2150 */
2151 if (!freopen(OutputFileName, "a", stderr))
2152 ereport(FATAL,
2154 errmsg("could not reopen file \"%s\" as stderr: %m",
2155 OutputFileName)));
2156
2157 /*
2158 * If the file is a tty and we're running under the postmaster, try to
2159 * send stdout there as well (if it isn't a tty then stderr will block
2160 * out stdout, so we may as well let stdout go wherever it was going
2161 * before).
2162 */
2163 if (istty && IsUnderPostmaster)
2164 if (!freopen(OutputFileName, "a", stdout))
2165 ereport(FATAL,
2167 errmsg("could not reopen file \"%s\" as stdout: %m",
2168 OutputFileName)));
2169 }
2170}
int errcode_for_file_access(void)
Definition: elog.c:886
int errmsg(const char *fmt,...)
Definition: elog.c:1080
#define FATAL
Definition: elog.h:41
#define ereport(elevel,...)
Definition: elog.h:150
bool IsUnderPostmaster
Definition: globals.c:120
char OutputFileName[MAXPGPATH]
Definition: globals.c:79
#define close(a)
Definition: win32.h:12
static int fd(const char *x, int i)
Definition: preproc-init.c:105

References close, ereport, errcode_for_file_access(), errmsg(), FATAL, fd(), IsUnderPostmaster, OutputFileName, and generate_unaccent_rules::stdout.

Referenced by BaseInit().

◆ EmitErrorReport()

void EmitErrorReport ( void  )

Definition at line 1704 of file elog.c.

1705{
1707 MemoryContext oldcontext;
1708
1711 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1712
1713 /*
1714 * Reset the formatted timestamp fields before emitting any logs. This
1715 * includes all the log destinations and emit_log_hook, as the latter
1716 * could use log_line_prefix or the formatted timestamps.
1717 */
1718 saved_timeval_set = false;
1719 formatted_log_time[0] = '\0';
1720
1721 /*
1722 * Call hook before sending message to log. The hook function is allowed
1723 * to turn off edata->output_to_server, so we must recheck that afterward.
1724 * Making any other change in the content of edata is not considered
1725 * supported.
1726 *
1727 * Note: the reason why the hook can only turn off output_to_server, and
1728 * not turn it on, is that it'd be unreliable: we will never get here at
1729 * all if errstart() deems the message uninteresting. A hook that could
1730 * make decisions in that direction would have to hook into errstart(),
1731 * where it would have much less information available. emit_log_hook is
1732 * intended for custom log filtering and custom log message transmission
1733 * mechanisms.
1734 *
1735 * The log hook has access to both the translated and original English
1736 * error message text, which is passed through to allow it to be used as a
1737 * message identifier. Note that the original text is not available for
1738 * detail, detail_log, hint and context text elements.
1739 */
1740 if (edata->output_to_server && emit_log_hook)
1741 (*emit_log_hook) (edata);
1742
1743 /* Send to server log, if enabled */
1744 if (edata->output_to_server)
1746
1747 /* Send to client, if enabled */
1748 if (edata->output_to_client)
1750
1751 MemoryContextSwitchTo(oldcontext);
1753}
static char formatted_log_time[FORMATTED_TS_LEN]
Definition: elog.c:161
static void send_message_to_frontend(ErrorData *edata)
Definition: elog.c:3545
static bool saved_timeval_set
Definition: elog.c:157
static int recursion_depth
Definition: elog.c:150
emit_log_hook_type emit_log_hook
Definition: elog.c:106
static void send_message_to_server_log(ErrorData *edata)
Definition: elog.c:3242
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:124
bool output_to_server
Definition: elog.h:422
bool output_to_client
Definition: elog.h:423

References ErrorData::assoc_context, CHECK_STACK_DEPTH, emit_log_hook, errordata, errordata_stack_depth, formatted_log_time, MemoryContextSwitchTo(), ErrorData::output_to_client, ErrorData::output_to_server, 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_generic_string()

int err_generic_string ( int  field,
const char *  str 
)

Definition at line 1546 of file elog.c.

1547{
1549
1550 /* we don't bother incrementing recursion_depth */
1552
1553 switch (field)
1554 {
1557 break;
1558 case PG_DIAG_TABLE_NAME:
1560 break;
1563 break;
1566 break;
1569 break;
1570 default:
1571 elog(ERROR, "unsupported ErrorData field id: %d", field);
1572 break;
1573 }
1574
1575 return 0; /* return value does not matter */
1576}
static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str)
Definition: elog.c:1582
#define elog(elevel,...)
Definition: elog.h:226
const char * str
#define PG_DIAG_SCHEMA_NAME
Definition: postgres_ext.h:65
#define PG_DIAG_CONSTRAINT_NAME
Definition: postgres_ext.h:69
#define PG_DIAG_DATATYPE_NAME
Definition: postgres_ext.h:68
#define PG_DIAG_TABLE_NAME
Definition: postgres_ext.h:66
#define PG_DIAG_COLUMN_NAME
Definition: postgres_ext.h:67

References ErrorData::assoc_context, CHECK_STACK_DEPTH, ErrorData::column_name, ErrorData::constraint_name, ErrorData::datatype_name, elog, ERROR, errordata, errordata_stack_depth, PG_DIAG_COLUMN_NAME, PG_DIAG_CONSTRAINT_NAME, PG_DIAG_DATATYPE_NAME, PG_DIAG_SCHEMA_NAME, PG_DIAG_TABLE_NAME, ErrorData::schema_name, set_errdata_field(), str, and ErrorData::table_name.

Referenced by errdatatype(), errdomainconstraint(), errtable(), errtablecolname(), errtableconstraint(), exec_stmt_raise(), PLy_elog_impl(), and PLy_output().

◆ errbacktrace()

int errbacktrace ( void  )

Definition at line 1102 of file elog.c.

1103{
1105 MemoryContext oldcontext;
1106
1109 oldcontext = MemoryContextSwitchTo(edata->assoc_context);
1110
1111 set_backtrace(edata, 1);
1112
1113 MemoryContextSwitchTo(oldcontext);
1115
1116 return 0;
1117}
static pg_noinline void set_backtrace(ErrorData *edata, int num_skip)
Definition: elog.c:1126

References ErrorData::assoc_context, CHECK_STACK_DEPTH, errordata, errordata_stack_depth, MemoryContextSwitchTo(), recursion_depth, and set_backtrace().

◆ errcode()

int errcode ( int  sqlerrcode)

Definition at line 863 of file elog.c.

864{
866
867 /* we don't bother incrementing recursion_depth */
869
870 edata->sqlerrcode = sqlerrcode;
871
872 return 0; /* return value does not matter */
873}
int sqlerrcode
Definition: elog.h:431

References CHECK_STACK_DEPTH, errordata, errordata_stack_depth, and ErrorData::sqlerrcode.

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(), 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(), 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(), 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(), 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_get_slice(), array_in(), 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(), ATExecAlterColumnGenericOptions(), ATExecAlterColumnType(), ATExecAlterConstraint(), ATExecAttachPartition(), ATExecAttachPartitionIdx(), ATExecChangeOwner(), ATExecClusterOn(), ATExecColumnDefault(), ATExecDetachPartition(), ATExecDropColumn(), ATExecDropConstraint(), ATExecDropExpression(), ATExecDropIdentity(), ATExecDropInherit(), ATExecDropNotNull(), ATExecDropOf(), ATExecGenericOptions(), ATExecReplicaIdentity(), ATExecSetCompression(), ATExecSetExpression(), ATExecSetIdentity(), ATExecSetNotNull(), ATExecSetOptions(), ATExecSetRelOptions(), ATExecSetStatistics(), ATExecSetStorage(), ATExecValidateConstraint(), ATPrepAddColumn(), ATPrepAddInherit(), ATPrepAlterColumnType(), AtPrepare_Locks(), AtPrepare_Notify(), AtPrepare_RelationMap(), 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(), 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(), bgworker_die(), 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(), 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_and_init_gencol(), check_and_set_sync_info(), check_av_worker_gucs(), check_can_set_role(), check_circularity(), check_collation_set(), 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_enable_rls(), check_encoding_locale_matches(), check_escape_warning(), 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_nested_generated_walker(), check_new_partition_bound(), check_oauth_validator(), check_object_ownership(), check_of_type(), check_parameter_resolution_walker(), 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_string_escape_warning(), check_temp_tablespaces(), check_transform_function(), check_unicode_value(), check_valid_extension_name(), check_valid_version_name(), 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(), CheckPredicate(), CheckPubRelationColumnList(), CheckRecoveryConflictDeadlock(), CheckRelationTableSpaceMove(), CheckRequiredParameterValues(), CheckRestrictedOperation(), checkRuleResultList(), CheckSASLAuth(), 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(), circle_recv(), ClientAuthentication(), CloneFkReferencing(), ClosePipeFromProgram(), ClosePipeToProgram(), cluster(), cluster_rel(), coerce_record_to_complex(), coerce_to_boolean(), coerce_to_common_type(), coerce_to_specific_type_typmod(), coerceJsonFuncExpr(), CollationCreate(), collectMatchBitmap(), 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(), 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(), CreatePolicy(), CreatePortal(), CreatePredicateLock(), CreateProceduralLanguage(), 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(), 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(), DetermineTimeZoneAbbrevOffsetTS(), dintdict_init(), dispell_init(), div_var(), div_var_int(), dlog1(), dlog10(), do_analyze_rel(), 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(), EnableDisableRule(), EnableDisableTrigger(), EnableLockPagesPrivilege(), encrypt_password(), EndPrepare(), EndTransactionBlock(), enforce_generic_type_consistency(), 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(), 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(), ExecOnConflictUpdate(), ExecOpenScanRelation(), ExecPartitionCheckEmitError(), ExecPrepareTuplestoreResult(), ExecReindex(), ExecScanSubPlan(), ExecSecLabelStmt(), ExecSetParamPlan(), ExecSetVariableStmt(), ExecUpdate(), execute_extension_script(), execute_sql_string(), executeBinaryArithmExpr(), ExecuteCallStmt(), executeDateTimeMethod(), ExecuteDoStmt(), ExecuteGrantStmt(), executeItemOptUnwrapTarget(), executeKeyValueMethod(), executeNumericItemMethod(), ExecuteQuery(), ExecuteTruncate(), executeUnaryArithmExpr(), ExecVacuum(), ExecWaitStmt(), ExecWithCheckOptions(), ExecWithoutOverlapsNotEmpty(), ExitPostmaster(), exp_var(), expand_col_privileges(), expand_vacuum_rel(), ExpandAllTables(), ExpandColumnRefStar(), expandTableLikeClause(), ExportSnapshot(), exprType(), ExtendBufferedRelLocal(), ExtendBufferedRelShared(), 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_underflow_error(), float_zero_divide_error(), FloatExceptionHandler(), fmgr_info_cxt_security(), fmgr_internal_validator(), fmgr_sql(), fmgr_sql_validator(), forbidden_in_wal_sender(), 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_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_attr_stat_type(), 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_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_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_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(), 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(), 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_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(), 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_concurrently_create_copy(), index_constraint_create(), index_create(), 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_MultiFuncCall(), init_params(), init_sexpr(), initArrayResultArr(), InitControlFile(), InitFileAccess(), initGinState(), initialize_dh(), initialize_ecdh(), initialize_peragg(), InitializeClientEncoding(), InitializeMaxBackends(), InitializeSessionUserId(), InitLocalBuffers(), InitMaterializedSRF(), InitPgFdwOptions(), InitPostgres(), InitProcess(), InitTempTableNamespace(), initTrie(), InitWalRecovery(), InitXLogReaderState(), inner_subltree(), 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_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_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(), lazy_scan_prune(), length_in_encoding(), libpqrcv_alter_slot(), libpqrcv_check_conninfo(), libpqrcv_connect(), libpqrcv_create_slot(), libpqrcv_endstreaming(), libpqrcv_exec(), libpqrcv_get_conninfo(), libpqrcv_get_dbname_from_conninfo(), libpqrcv_identify_system(), libpqrcv_processTuples(), libpqrcv_readtimelinehistoryfile(), libpqrcv_receive(), libpqrcv_send(), libpqrcv_startstreaming(), libpqsrv_connect_prepare(), libpqsrv_PQwrap(), like_fixed_prefix(), 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_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(), makeRangeVarFromNameList(), makeWholeRowVar(), map_sql_value_to_xml_value(), mark_index_clustered(), 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(), 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_extension_control_file(), parse_fcall_arguments(), parse_format(), parse_hba_auth_opt(), parse_hba_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(), 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_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_expr_worker(), pg_get_functiondef(), pg_get_multixact_members(), pg_get_object_address(), pg_get_serial_sequence(), 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_size_bytes(), pg_snapshot_recv(), pg_split_walfile_name(), 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(), PGSharedMemoryCreate(), pgss_shmem_startup(), 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(), 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(), ProcessCancelRequestPacket(), ProcessConfigFileInternal(), ProcessCopyOptions(), ProcessInterrupts(), ProcessParallelApplyMessage(), ProcessParallelApplyMessages(), ProcessParallelMessages(), ProcessPgArchInterrupts(), ProcessRecoveryConflictInterrupt(), ProcessRepliesIfAny(), ProcessSSLStartup(), ProcessStandbyMessage(), ProcessStartupPacket(), ProcessTwoPhaseBuffer(), processTypesSpec(), ProcessUtilitySlow(), protect_out_of_mem(), prsd_headline(), prseof(), 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(), repeat(), replace_percent_placeholders(), replace_rte_variables_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(), report_name_conflict(), report_namespace_conflict(), report_newlocale_failure(), 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(), 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_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_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(), setSchemaName(), 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(), ShmemAllocUnlocked(), ShmemInitStruct(), should_apply_changes_for_rel(), should_refetch_tuple(), similar_escape_internal(), SlabContextCreate(), slot_modify_data(), slot_store_data(), SnapBuildInitialSnapshot(), SnapBuildRestoreContents(), SnapBuildRestoreSnapshot(), socket_set_nonblocking(), SocketBackend(), sort(), spgadjustmembers(), spgdoinsert(), spgFormInnerTuple(), spgFormNodeTuple(), spgGetCache(), spgvalidate(), SPI_cursor_open_internal(), split_part(), sql_compile_callback(), sql_postrewrite_callback(), sqrt_var(), ssl_extension_info(), standard_ProcessUtility(), StandbySlotsHaveCaughtup(), StartBackgroundWorker(), StartChildProcess(), StartReplication(), StartupDecodingContext(), StartupReplicationOrigin(), StartupXLOG(), stats_check_arg_array(), stats_check_arg_pair(), stats_check_required_arg(), 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_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(), text_to_stavalues(), 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(), transformDistinctClause(), transformDistinctOnClause(), transformExprRecurse(), transformFkeyCheckAttrs(), transformFkeyGetPrimaryKey(), transformFrameOffset(), transformFromClauseItem(), transformGenericOptions(), transformGroupingFunc(), transformGroupingSet(), TransformGUCArray(), transformIndexConstraint(), transformIndexStmt(), transformIndirection(), transformInsertRow(), transformJsonAggConstructor(), transformJsonArrayQueryConstructor(), transformJsonBehavior(), transformJsonFuncExpr(), transformJsonIsPredicate(), transformJsonOutput(), transformJsonParseArg(), transformJsonParseExpr(), transformJsonReturning(), transformJsonSerializeExpr(), transformJsonTable(), transformJsonTableColumns(), transformJsonValueExpr(), transformLimitClause(), transformLockingClause(), transformMergeStmt(), transformMergeSupportFunc(), transformMultiAssignRef(), transformOnConflictArbiter(), transformParamRef(), transformPartitionBound(), transformPartitionBoundValue(), transformPartitionCmd(), transformPartitionRangeBounds(), transformPartitionSpec(), transformPLAssignStmtTarget(), TransformPubWhereClauses(), transformRangeFunction(), transformRangeTableFunc(), transformRangeTableSample(), transformRelOptions(), transformReturningClause(), transformRowExpr(), transformRuleStmt(), transformSelectStmt(), transformSetOperationStmt(), transformSetOperationTree(), transformStatsStmt(), transformSubLink(), transformTableConstraint(), transformTableLikeClause(), transformTypeCast(), 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(), 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(), 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_kind(), validate_remote_info(), validate_table_rewrite_tags(), validate_token_format(), 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(), 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(), xlog_decode(), 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 886 of file elog.c.

887{
889
890 /* we don't bother incrementing recursion_depth */
892
893 switch (edata->saved_errno)
894 {
895 /* Permission-denied failures */
896 case EPERM: /* Not super-user */
897 case EACCES: /* Permission denied */
898#ifdef EROFS
899 case EROFS: /* Read only file system */
900#endif
901 edata->sqlerrcode = ERRCODE_INSUFFICIENT_PRIVILEGE;
902 break;
903
904 /* File not found */
905 case ENOENT: /* No such file or directory */
906 edata->sqlerrcode = ERRCODE_UNDEFINED_FILE;
907 break;
908
909 /* Duplicate file */
910 case EEXIST: /* File exists */
911 edata->sqlerrcode = ERRCODE_DUPLICATE_FILE;
912 break;
913
914 /* Wrong object type or state */
915 case ENOTDIR: /* Not a directory */
916 case EISDIR: /* Is a directory */
917 case ENOTEMPTY: /* Directory not empty */
918 edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE;
919 break;
920
921 /* Insufficient resources */
922 case ENOSPC: /* No space left on device */
923 edata->sqlerrcode = ERRCODE_DISK_FULL;
924 break;
925
926 case ENOMEM: /* Out of memory */
927 edata->sqlerrcode = ERRCODE_OUT_OF_MEMORY;
928 break;
929
930 case ENFILE: /* File table overflow */
931 case EMFILE: /* Too many open files */
932 edata->sqlerrcode = ERRCODE_INSUFFICIENT_RESOURCES;
933 break;
934
935 /* Hardware failure */
936 case EIO: /* I/O error */
937 edata->sqlerrcode = ERRCODE_IO_ERROR;
938 break;
939
940 case ENAMETOOLONG: /* File name too long */
941 edata->sqlerrcode = ERRCODE_FILE_NAME_TOO_LONG;
942 break;
943
944 /* All else is classified as internal errors */
945 default:
946 edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
947 break;
948 }
949
950 return 0; /* return value does not matter */
951}
int saved_errno
Definition: elog.h:447

References CHECK_STACK_DEPTH, errordata, errordata_stack_depth, ErrorData::saved_errno, and ErrorData::sqlerrcode.

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(), PGReserveSemaphores(), PGSharedMemoryCreate(), pgss_shmem_shutdown(), pgss_shmem_startup(), 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(), 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 963 of file elog.c.

964{
966
967 /* we don't bother incrementing recursion_depth */
969
970 switch (edata->saved_errno)
971 {
972 /* Loss of connection */
974 edata->sqlerrcode = ERRCODE_CONNECTION_FAILURE;
975 break;
976
977 /* All else is classified as internal errors */
978 default:
979 edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
980 break;
981 }
982
983 return 0; /* return value does not matter */
984}
#define ALL_CONNECTION_FAILURE_ERRNOS
Definition: port.h:122

References ALL_CONNECTION_FAILURE_ERRNOS, CHECK_STACK_DEPTH, errordata, errordata_stack_depth, ErrorData::saved_errno, and ErrorData::sqlerrcode.

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().

◆ errcontext_msg()

int errcontext_msg ( const char *  fmt,
  ... 
)

◆ errdetail()

int errdetail ( const char *  fmt,
  ... 
)

◆ errdetail_internal()

int int errdetail_internal ( const char *  fmt,
  ... 
)

◆ errdetail_log()

int int int errdetail_log ( const char *  fmt,
  ... 
)

◆ errdetail_log_plural()

int int int int errdetail_log_plural ( const char *  fmt_singular,
const char *  fmt_plural,
unsigned long  n,
  ... 
)

◆ errdetail_plural()

int errdetail_plural ( const char *  fmt_singular,
const char *  fmt_plural,
unsigned long  n,
  ... 
)

◆ errfinish()

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

Definition at line 474 of file elog.c.

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

References ErrorContextCallback::arg, ErrorData::backtrace, backtrace_functions, ErrorContextCallback::callback, CHECK_FOR_INTERRUPTS, CHECK_STACK_DEPTH, CritSectionCount, DestNone, DestRemote, DISCONNECT_FATAL, DISCONNECT_NORMAL, ErrorData::elevel, EmitErrorReport(), ERROR, error_context_stack, ErrorContext, errordata, errordata_stack_depth, FATAL, filename, FreeErrorDataContents(), ErrorData::funcname, 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().

◆ errhidecontext()

int errhidecontext ( bool  hide_ctx)

Definition at line 1464 of file elog.c.

1465{
1467
1468 /* we don't bother incrementing recursion_depth */
1470
1471 edata->hide_ctx = hide_ctx;
1472
1473 return 0; /* return value does not matter */
1474}
bool hide_ctx
Definition: elog.h:425

References CHECK_STACK_DEPTH, errordata, errordata_stack_depth, and ErrorData::hide_ctx.

Referenced by buffer_call_start_io(), buffer_call_terminate_io(), llvm_compile_module(), MemoryContextStatsDetail(), MemoryContextStatsInternal(), MemoryContextStatsPrint(), and ProcessLogMemoryContextInterrupt().

◆ errhidestmt()

int int errhidestmt ( bool  hide_stmt)

Definition at line 1445 of file elog.c.

1446{
1448
1449 /* we don't bother incrementing recursion_depth */
1451
1452 edata->hide_stmt = hide_stmt;
1453
1454 return 0; /* return value does not matter */
1455}

References CHECK_STACK_DEPTH, errordata, errordata_stack_depth, and ErrorData::hide_stmt.

Referenced by buffer_call_start_io(), buffer_call_terminate_io(), exec_bind_message(), exec_execute_message(), exec_parse_message(), exec_simple_query(), explain_ExecutorEnd(), llvm_compile_module(), MemoryContextStatsDetail(), MemoryContextStatsInternal(), MemoryContextStatsPrint(), and ProcessLogMemoryContextInterrupt().

◆ errhint()

int errhint ( const char *  fmt,
  ... 
)

◆ errhint_internal()

int int errhint_internal ( const char *  fmt,
  ... 
)

◆ errhint_plural()

int int int errhint_plural ( const char *  fmt_singular,
const char *  fmt_plural,
unsigned long  n,
  ... 
)

◆ errmsg()

int errmsg ( const char *  fmt,
  ... 
)

◆ errmsg_internal()

int int errmsg_internal ( const char *  fmt,
  ... 
)

◆ errmsg_plural()

int int int errmsg_plural ( const char *  fmt_singular,
const char *  fmt_plural,
unsigned long  n,
  ... 
)

◆ error_severity()

const char * error_severity ( int  elevel)

Definition at line 3723 of file elog.c.

3724{
3725 const char *prefix;
3726
3727 switch (elevel)
3728 {
3729 case DEBUG1:
3730 case DEBUG2:
3731 case DEBUG3:
3732 case DEBUG4:
3733 case DEBUG5:
3734 prefix = gettext_noop("DEBUG");
3735 break;
3736 case LOG:
3737 case LOG_SERVER_ONLY:
3738 prefix = gettext_noop("LOG");
3739 break;
3740 case INFO:
3741 prefix = gettext_noop("INFO");
3742 break;
3743 case NOTICE:
3744 prefix = gettext_noop("NOTICE");
3745 break;
3746 case WARNING:
3748 prefix = gettext_noop("WARNING");
3749 break;
3750 case ERROR:
3751 prefix = gettext_noop("ERROR");
3752 break;
3753 case FATAL:
3754 prefix = gettext_noop("FATAL");
3755 break;
3756 case PANIC:
3757 prefix = gettext_noop("PANIC");
3758 break;
3759 default:
3760 prefix = "???";
3761 break;
3762 }
3763
3764 return prefix;
3765}
#define gettext_noop(x)
Definition: c.h:1184
#define LOG
Definition: elog.h:31
#define DEBUG3
Definition: elog.h:28
#define WARNING_CLIENT_ONLY
Definition: elog.h:38
#define WARNING
Definition: elog.h:36
#define DEBUG2
Definition: elog.h:29
#define DEBUG1
Definition: elog.h:30
#define NOTICE
Definition: elog.h:35
#define INFO
Definition: elog.h:34
#define DEBUG5
Definition: elog.h:26
#define DEBUG4
Definition: elog.h:27

References DEBUG1, DEBUG2, DEBUG3, DEBUG4, DEBUG5, ERROR, FATAL, 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().

◆ errposition()

int errposition ( int  cursorpos)

Definition at line 1480 of file elog.c.

1481{
1483
1484 /* we don't bother incrementing recursion_depth */
1486
1487 edata->cursorpos = cursorpos;
1488
1489 return 0; /* return value does not matter */
1490}
int cursorpos
Definition: elog.h:444

References CHECK_STACK_DEPTH, ErrorData::cursorpos, errordata, and errordata_stack_depth.

Referenced by _SPI_error_callback(), executor_errposition(), function_parse_error_transpose(), import_error_callback(), parser_errposition(), scanner_errposition(), script_error_callback(), sql_compile_error_callback(), sql_exec_error_callback(), and sql_inline_error_callback().

◆ errsave_finish()

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

Definition at line 691 of file elog.c.

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

References CHECK_STACK_DEPTH, ErrorData::elevel, errfinish(), ERROR, ErrorSaveContext::error_data, errordata, errordata_stack_depth, filename, funcname, 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 639 of file elog.c.

640{
641 ErrorSaveContext *escontext;
642 ErrorData *edata;
643
644 /*
645 * Do we have a context for soft error reporting? If not, just punt to
646 * errstart().
647 */
648 if (context == NULL || !IsA(context, ErrorSaveContext))
649 return errstart(ERROR, domain);
650
651 /* Report that a soft error was detected */
652 escontext = (ErrorSaveContext *) context;
653 escontext->error_occurred = true;
654
655 /* Nothing else to do if caller wants no further details */
656 if (!escontext->details_wanted)
657 return false;
658
659 /*
660 * Okay, crank up a stack entry to store the info in.
661 */
662
664
665 /* Initialize data for this error frame */
666 edata = get_error_stack_entry();
667 edata->elevel = LOG; /* signal all is well to errsave_finish */
668 set_stack_entry_domain(edata, domain);
669 /* Select default errcode based on the assumed elevel of ERROR */
670 edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
671
672 /*
673 * Any allocations for this error state level should go into the caller's
674 * context. We don't need to pollute ErrorContext, or even require it to
675 * exist, in this code path.
676 */
678
680 return true;
681}
bool errstart(int elevel, const char *domain)
Definition: elog.c:343
static ErrorData * get_error_stack_entry(void)
Definition: elog.c:761
static void set_stack_entry_domain(ErrorData *edata, const char *domain)
Definition: elog.c:788
#define IsA(nodeptr, _type_)
Definition: nodes.h:164
bool details_wanted
Definition: miscnodes.h:48
bool error_occurred
Definition: miscnodes.h:47

References ErrorData::assoc_context, CurrentMemoryContext, ErrorSaveContext::details_wanted, ErrorData::elevel, ERROR, ErrorSaveContext::error_occurred, errstart(), get_error_stack_entry(), IsA, LOG, recursion_depth, set_stack_entry_domain(), and ErrorData::sqlerrcode.

◆ errstart()

bool errstart ( int  elevel,
const char *  domain 
)

Definition at line 343 of file elog.c.

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

References ErrorData::assoc_context, CritSectionCount, debug_query_string, ErrorData::elevel, ERROR, error_context_stack, ErrorContext, errordata, errordata_stack_depth, ExitOnAnyError, FATAL, get_error_stack_entry(), i, in_error_recursion_trouble(), Max, MemoryContextReset(), ErrorData::output_to_client, ErrorData::output_to_server, PANIC, PG_exception_stack, proc_exit_inprogress, recursion_depth, set_stack_entry_domain(), should_output_to_client(), should_output_to_server(), ErrorData::sqlerrcode, 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 327 of file elog.c.

328{
329 return errstart(elevel, domain);
330}

References errstart().

◆ FlushErrorState()

◆ format_elog_string()

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

◆ FreeErrorData()

void FreeErrorData ( ErrorData edata)

◆ get_backend_type_for_log()

const char * get_backend_type_for_log ( void  )

Definition at line 2775 of file elog.c.

2776{
2777 const char *backend_type_str;
2778
2779 if (MyProcPid == PostmasterPid)
2780 backend_type_str = "postmaster";
2781 else if (MyBackendType == B_BG_WORKER)
2782 backend_type_str = MyBgworkerEntry->bgw_type;
2783 else
2784 backend_type_str = GetBackendTypeDesc(MyBackendType);
2785
2786 return backend_type_str;
2787}
pid_t PostmasterPid
Definition: globals.c:106
int MyProcPid
Definition: globals.c:47
@ B_BG_WORKER
Definition: miscadmin.h:346
const char * GetBackendTypeDesc(BackendType backendType)
Definition: miscinit.c:263
BackendType MyBackendType
Definition: miscinit.c:64
BackgroundWorker * MyBgworkerEntry
Definition: postmaster.c:200
char bgw_type[BGW_MAXLEN]
Definition: bgworker.h:92

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

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

◆ get_formatted_log_time()

char * get_formatted_log_time ( void  )

Definition at line 2678 of file elog.c.

2679{
2680 pg_time_t stamp_time;
2681 char msbuf[13];
2682
2683 /* leave if already computed */
2684 if (formatted_log_time[0] != '\0')
2685 return formatted_log_time;
2686
2687 if (!saved_timeval_set)
2688 {
2690 saved_timeval_set = true;
2691 }
2692
2693 stamp_time = (pg_time_t) saved_timeval.tv_sec;
2694
2695 /*
2696 * Note: we expect that guc.c will ensure that log_timezone is set up (at
2697 * least with a minimal GMT value) before Log_line_prefix can become
2698 * nonempty or CSV/JSON mode can be selected.
2699 */
2701 /* leave room for milliseconds... */
2702 "%Y-%m-%d %H:%M:%S %Z",
2703 pg_localtime(&stamp_time, log_timezone));
2704
2705 /* 'paste' milliseconds into place... */
2706 sprintf(msbuf, ".%03d", (int) (saved_timeval.tv_usec / 1000));
2707 memcpy(formatted_log_time + 19, msbuf, 4);
2708
2709 return formatted_log_time;
2710}
#define FORMATTED_TS_LEN
Definition: elog.c:159
static struct timeval saved_timeval
Definition: elog.c:156
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 formatted_log_time, FORMATTED_TS_LEN, gettimeofday(), log_timezone, 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 2728 of file elog.c.

2729{
2730 pg_time_t stamp_time = (pg_time_t) MyStartTime;
2731
2732 /* leave if already computed */
2733 if (formatted_start_time[0] != '\0')
2734 return formatted_start_time;
2735
2736 /*
2737 * Note: we expect that guc.c will ensure that log_timezone is set up (at
2738 * least with a minimal GMT value) before Log_line_prefix can become
2739 * nonempty or CSV/JSON mode can be selected.
2740 */
2742 "%Y-%m-%d %H:%M:%S %Z",
2743 pg_localtime(&stamp_time, log_timezone));
2744
2745 return formatted_start_time;
2746}
static char formatted_start_time[FORMATTED_TS_LEN]
Definition: elog.c:160
pg_time_t MyStartTime
Definition: globals.c:48

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

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

◆ geterrcode()

int geterrcode ( void  )

Definition at line 1595 of file elog.c.

1596{
1598
1599 /* we don't bother incrementing recursion_depth */
1601
1602 return edata->sqlerrcode;
1603}

References CHECK_STACK_DEPTH, errordata, errordata_stack_depth, and ErrorData::sqlerrcode.

Referenced by pcb_error_callback(), and scb_error_callback().

◆ GetErrorContextStack()

char * GetErrorContextStack ( void  )

Definition at line 2076 of file elog.c.

2077{
2078 ErrorData *edata;
2079 ErrorContextCallback *econtext;
2080
2081 /*
2082 * Crank up a stack entry to store the info in.
2083 */
2085
2086 edata = get_error_stack_entry();
2087
2088 /*
2089 * Set up assoc_context to be the caller's context, so any allocations
2090 * done (which will include edata->context) will use their context.
2091 */
2093
2094 /*
2095 * Call any context callback functions to collect the context information
2096 * into edata->context.
2097 *
2098 * Errors occurring in callback functions should go through the regular
2099 * error handling code which should handle any recursive errors, though we
2100 * double-check above, just in case.
2101 */
2102 for (econtext = error_context_stack;
2103 econtext != NULL;
2104 econtext = econtext->previous)
2105 econtext->callback(econtext->arg);
2106
2107 /*
2108 * Clean ourselves off the stack, any allocations done should have been
2109 * using edata->assoc_context, which we set up earlier to be the caller's
2110 * context, so we're free to just remove our entry off the stack and
2111 * decrement recursion depth and exit.
2112 */
2115
2116 /*
2117 * Return a pointer to the string the caller asked for, which should have
2118 * been allocated in their context.
2119 */
2120 return edata->context;
2121}

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

Referenced by exec_stmt_getdiag().

◆ geterrposition()

int geterrposition ( void  )

Definition at line 1612 of file elog.c.

1613{
1615
1616 /* we don't bother incrementing recursion_depth */
1618
1619 return edata->cursorpos;
1620}

References CHECK_STACK_DEPTH, ErrorData::cursorpos, errordata, and errordata_stack_depth.

Referenced by _SPI_error_callback(), function_parse_error_transpose(), import_error_callback(), script_error_callback(), sql_compile_error_callback(), sql_exec_error_callback(), and sql_inline_error_callback().

◆ getinternalerrposition()

int getinternalerrposition ( void  )

Definition at line 1629 of file elog.c.

1630{
1632
1633 /* we don't bother incrementing recursion_depth */
1635
1636 return edata->internalpos;
1637}
int internalpos
Definition: elog.h:445

References CHECK_STACK_DEPTH, errordata, errordata_stack_depth, and ErrorData::internalpos.

Referenced by function_parse_error_transpose().

◆ in_error_recursion_trouble()

bool in_error_recursion_trouble ( void  )

Definition at line 294 of file elog.c.

295{
296 /* Pull the plug if recurse more than once */
297 return (recursion_depth > 2);
298}

References recursion_depth.

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

◆ internalerrposition()

int internalerrposition ( int  cursorpos)

Definition at line 1496 of file elog.c.

1497{
1499
1500 /* we don't bother incrementing recursion_depth */
1502
1503 edata->internalpos = cursorpos;
1504
1505 return 0; /* return value does not matter */
1506}

References CHECK_STACK_DEPTH, errordata, errordata_stack_depth, and ErrorData::internalpos.

Referenced by _SPI_error_callback(), function_parse_error_transpose(), import_error_callback(), plpgsql_scanner_errposition(), PLy_elog_impl(), script_error_callback(), sql_compile_error_callback(), sql_exec_error_callback(), and sql_inline_error_callback().

◆ internalerrquery()

int internalerrquery ( const char *  query)

Definition at line 1516 of file elog.c.

1517{
1519
1520 /* we don't bother incrementing recursion_depth */
1522
1523 if (edata->internalquery)
1524 {
1525 pfree(edata->internalquery);
1526 edata->internalquery = NULL;
1527 }
1528
1529 if (query)
1530 edata->internalquery = MemoryContextStrdup(edata->assoc_context, query);
1531
1532 return 0; /* return value does not matter */
1533}
char * MemoryContextStrdup(MemoryContext context, const char *string)
Definition: mcxt.c:1746

References ErrorData::assoc_context, CHECK_STACK_DEPTH, errordata, errordata_stack_depth, ErrorData::internalquery, MemoryContextStrdup(), and pfree().

Referenced by _SPI_error_callback(), function_parse_error_transpose(), import_error_callback(), plpgsql_scanner_errposition(), PLy_elog_impl(), script_error_callback(), sql_compile_error_callback(), sql_exec_error_callback(), and sql_inline_error_callback().

◆ log_status_format()

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

Definition at line 2837 of file elog.c.

2838{
2839 /* static counter for line numbers */
2840 static long log_line_number = 0;
2841
2842 /* has counter been reset in current process? */
2843 static int log_my_pid = 0;
2844 int padding;
2845 const char *p;
2846
2847 /*
2848 * This is one of the few places where we'd rather not inherit a static
2849 * variable's value from the postmaster. But since we will, reset it when
2850 * MyProcPid changes. MyStartTime also changes when MyProcPid does, so
2851 * reset the formatted start timestamp too.
2852 */
2853 if (log_my_pid != MyProcPid)
2854 {
2855 log_line_number = 0;
2856 log_my_pid = MyProcPid;
2858 }
2859 log_line_number++;
2860
2861 if (format == NULL)
2862 return; /* in case guc hasn't run yet */
2863
2864 for (p = format; *p != '\0'; p++)
2865 {
2866 if (*p != '%')
2867 {
2868 /* literal char, just copy */
2870 continue;
2871 }
2872
2873 /* must be a '%', so skip to the next char */
2874 p++;
2875 if (*p == '\0')
2876 break; /* format error - ignore it */
2877 else if (*p == '%')
2878 {
2879 /* string contains %% */
2881 continue;
2882 }
2883
2884
2885 /*
2886 * Process any formatting which may exist after the '%'. Note that
2887 * process_log_prefix_padding moves p past the padding number if it
2888 * exists.
2889 *
2890 * Note: Since only '-', '0' to '9' are valid formatting characters we
2891 * can do a quick check here to pre-check for formatting. If the char
2892 * is not formatting then we can skip a useless function call.
2893 *
2894 * Further note: At least on some platforms, passing %*s rather than
2895 * %s to appendStringInfo() is substantially slower, so many of the
2896 * cases below avoid doing that unless non-zero padding is in fact
2897 * specified.
2898 */
2899 if (*p > '9')
2900 padding = 0;
2901 else if ((p = process_log_prefix_padding(p, &padding)) == NULL)
2902 break;
2903
2904 /* process the option */
2905 switch (*p)
2906 {
2907 case 'a':
2908 if (MyProcPort)
2909 {
2910 const char *appname = application_name;
2911
2912 if (appname == NULL || *appname == '\0')
2913 appname = _("[unknown]");
2914 if (padding != 0)
2915 appendStringInfo(buf, "%*s", padding, appname);
2916 else
2917 appendStringInfoString(buf, appname);
2918 }
2919 else if (padding != 0)
2921 padding > 0 ? padding : -padding);
2922
2923 break;
2924 case 'b':
2925 {
2926 const char *backend_type_str = get_backend_type_for_log();
2927
2928 if (padding != 0)
2929 appendStringInfo(buf, "%*s", padding, backend_type_str);
2930 else
2931 appendStringInfoString(buf, backend_type_str);
2932 break;
2933 }
2934 case 'u':
2935 if (MyProcPort)
2936 {
2937 const char *username = MyProcPort->user_name;
2938
2939 if (username == NULL || *username == '\0')
2940 username = _("[unknown]");
2941 if (padding != 0)
2942 appendStringInfo(buf, "%*s", padding, username);
2943 else
2945 }
2946 else if (padding != 0)
2948 padding > 0 ? padding : -padding);
2949 break;
2950 case 'd':
2951 if (MyProcPort)
2952 {
2953 const char *dbname = MyProcPort->database_name;
2954
2955 if (dbname == NULL || *dbname == '\0')
2956 dbname = _("[unknown]");
2957 if (padding != 0)
2958 appendStringInfo(buf, "%*s", padding, dbname);
2959 else
2961 }
2962 else if (padding != 0)
2964 padding > 0 ? padding : -padding);
2965 break;
2966 case 'c':
2967 if (padding != 0)
2968 {
2969 char strfbuf[128];
2970
2971 snprintf(strfbuf, sizeof(strfbuf) - 1, "%" PRIx64 ".%x",
2973 appendStringInfo(buf, "%*s", padding, strfbuf);
2974 }
2975 else
2976 appendStringInfo(buf, "%" PRIx64 ".%x", MyStartTime, MyProcPid);
2977 break;
2978 case 'p':
2979 if (padding != 0)
2980 appendStringInfo(buf, "%*d", padding, MyProcPid);
2981 else
2983 break;
2984
2985 case 'P':
2986 if (MyProc)
2987 {
2988 PGPROC *leader = MyProc->lockGroupLeader;
2989
2990 /*
2991 * Show the leader only for active parallel workers. This
2992 * leaves out the leader of a parallel group.
2993 */
2994 if (leader == NULL || leader->pid == MyProcPid)
2996 padding > 0 ? padding : -padding);
2997 else if (padding != 0)
2998 appendStringInfo(buf, "%*d", padding, leader->pid);
2999 else
3000 appendStringInfo(buf, "%d", leader->pid);
3001 }
3002 else if (padding != 0)
3004 padding > 0 ? padding : -padding);
3005 break;
3006
3007 case 'l':
3008 if (padding != 0)
3009 appendStringInfo(buf, "%*ld", padding, log_line_number);
3010 else
3011 appendStringInfo(buf, "%ld", log_line_number);
3012 break;
3013 case 'm':
3014 /* force a log timestamp reset */
3015 formatted_log_time[0] = '\0';
3016 (void) get_formatted_log_time();
3017
3018 if (padding != 0)
3019 appendStringInfo(buf, "%*s", padding, formatted_log_time);
3020 else
3022 break;
3023 case 't':
3024 {
3025 pg_time_t stamp_time = (pg_time_t) time(NULL);
3026 char strfbuf[128];
3027
3028 pg_strftime(strfbuf, sizeof(strfbuf),
3029 "%Y-%m-%d %H:%M:%S %Z",
3030 pg_localtime(&stamp_time, log_timezone));
3031 if (padding != 0)
3032 appendStringInfo(buf, "%*s", padding, strfbuf);
3033 else
3034 appendStringInfoString(buf, strfbuf);
3035 }
3036 break;
3037 case 'n':
3038 {
3039 char strfbuf[128];
3040
3041 if (!saved_timeval_set)
3042 {
3044 saved_timeval_set = true;
3045 }
3046
3047 snprintf(strfbuf, sizeof(strfbuf), "%ld.%03d",
3048 (long) saved_timeval.tv_sec,
3049 (int) (saved_timeval.tv_usec / 1000));
3050
3051 if (padding != 0)
3052 appendStringInfo(buf, "%*s", padding, strfbuf);
3053 else
3054 appendStringInfoString(buf, strfbuf);
3055 }
3056 break;
3057 case 's':
3058 {
3060
3061 if (padding != 0)
3062 appendStringInfo(buf, "%*s", padding, start_time);
3063 else
3065 }
3066 break;
3067 case 'i':
3068 if (MyProcPort)
3069 {
3070 const char *psdisp;
3071 int displen;
3072
3073 psdisp = get_ps_display(&displen);
3074 if (padding != 0)
3075 appendStringInfo(buf, "%*s", padding, psdisp);
3076 else
3077 appendBinaryStringInfo(buf, psdisp, displen);
3078 }
3079 else if (padding != 0)
3081 padding > 0 ? padding : -padding);
3082 break;
3083 case 'L':
3084 {
3085 const char *local_host;
3086
3087 if (MyProcPort)
3088 {
3089 if (MyProcPort->local_host[0] == '\0')
3090 {
3091 /*
3092 * First time through: cache the lookup, since it
3093 * might not have trivial cost.
3094 */
3098 sizeof(MyProcPort->local_host),
3099 NULL, 0,
3100 NI_NUMERICHOST | NI_NUMERICSERV);
3101 }
3102 local_host = MyProcPort->local_host;
3103 }
3104 else
3105 {
3106 /* Background process, or connection not yet made */
3107 local_host = "[none]";
3108 }
3109 if (padding != 0)
3110 appendStringInfo(buf, "%*s", padding, local_host);
3111 else
3112 appendStringInfoString(buf, local_host);
3113 }
3114 break;
3115 case 'r':
3117 {
3118 if (padding != 0)
3119 {
3120 if (MyProcPort->remote_port && MyProcPort->remote_port[0] != '\0')
3121 {
3122 /*
3123 * This option is slightly special as the port
3124 * number may be appended onto the end. Here we
3125 * need to build 1 string which contains the
3126 * remote_host and optionally the remote_port (if
3127 * set) so we can properly align the string.
3128 */
3129
3130 char *hostport;
3131
3132 hostport = psprintf("%s(%s)", MyProcPort->remote_host, MyProcPort->remote_port);
3133 appendStringInfo(buf, "%*s", padding, hostport);
3134 pfree(hostport);
3135 }
3136 else
3137 appendStringInfo(buf, "%*s", padding, MyProcPort->remote_host);
3138 }
3139 else
3140 {
3141 /* padding is 0, so we don't need a temp buffer */
3143 if (MyProcPort->remote_port &&
3144 MyProcPort->remote_port[0] != '\0')
3145 appendStringInfo(buf, "(%s)",
3147 }
3148 }
3149 else if (padding != 0)
3151 padding > 0 ? padding : -padding);
3152 break;
3153 case 'h':
3155 {
3156 if (padding != 0)
3157 appendStringInfo(buf, "%*s", padding, MyProcPort->remote_host);
3158 else
3160 }
3161 else if (padding != 0)
3163 padding > 0 ? padding : -padding);
3164 break;
3165 case 'q':
3166 /* in postmaster and friends, stop if %q is seen */
3167 /* in a backend, just ignore */
3168 if (MyProcPort == NULL)
3169 return;
3170 break;
3171 case 'v':
3172 /* keep VXID format in sync with lockfuncs.c */
3173 if (MyProc != NULL && MyProc->vxid.procNumber != INVALID_PROC_NUMBER)
3174 {
3175 if (padding != 0)
3176 {
3177 char strfbuf[128];
3178
3179 snprintf(strfbuf, sizeof(strfbuf) - 1, "%d/%u",
3181 appendStringInfo(buf, "%*s", padding, strfbuf);
3182 }
3183 else
3185 }
3186 else if (padding != 0)
3188 padding > 0 ? padding : -padding);
3189 break;
3190 case 'x':
3191 if (padding != 0)
3192 appendStringInfo(buf, "%*u", padding, GetTopTransactionIdIfAny());
3193 else
3195 break;
3196 case 'e':
3197 if (padding != 0)
3198 appendStringInfo(buf, "%*s", padding, unpack_sql_state(edata->sqlerrcode));
3199 else
3201 break;
3202 case 'Q':
3203 if (padding != 0)
3204 appendStringInfo(buf, "%*" PRId64, padding,
3206 else
3207 appendStringInfo(buf, "%" PRId64,
3209 break;
3210 default:
3211 /* format error - ignore it */
3212 break;
3213 }
3214 }
3215}
int64 pgstat_get_my_query_id(void)
static const char * process_log_prefix_padding(const char *p, int *ppadding)
Definition: elog.c:2797
char * get_formatted_start_time(void)
Definition: elog.c:2728
const char * get_backend_type_for_log(void)
Definition: elog.c:2775
char * get_formatted_log_time(void)
Definition: elog.c:2678
char * unpack_sql_state(int sql_state)
Definition: elog.c:3222
#define _(x)
Definition: elog.c:91
void reset_formatted_start_time(void)
Definition: elog.c:2716
struct Port * MyProcPort
Definition: globals.c:51
char * application_name
Definition: guc_tables.c:561
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
static char * buf
Definition: pg_test_fsync.c:72
#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:548
char * psprintf(const char *fmt,...)
Definition: psprintf.c:43
PGPROC * MyProc
Definition: proc.c:67
char * dbname
Definition: streamutil.c:49
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:145
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
Definition: stringinfo.c:281
void appendStringInfoSpaces(StringInfo str, int count)
Definition: stringinfo.c:260
void appendStringInfoString(StringInfo str, const char *s)
Definition: stringinfo.c:230
void appendStringInfoChar(StringInfo str, char ch)
Definition: stringinfo.c:242
Definition: proc.h:179
LocalTransactionId lxid
Definition: proc.h:217
struct PGPROC::@130 vxid
ProcNumber procNumber
Definition: proc.h:212
int pid
Definition: proc.h:199
PGPROC * lockGroupLeader
Definition: proc.h:321
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:442

References _, SockAddr::addr, appendBinaryStringInfo(), appendStringInfo(), appendStringInfoChar(), appendStringInfoSpaces(), appendStringInfoString(), application_name, buf, Port::database_name, dbname, 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, ErrorData::sqlerrcode, start_time, unpack_sql_state(), Port::user_name, username, and PGPROC::vxid.

Referenced by log_line_prefix().

◆ message_level_is_interesting()

bool message_level_is_interesting ( int  elevel)

Definition at line 273 of file elog.c.

274{
275 /*
276 * Keep this in sync with the decision-making in errstart().
277 */
278 if (elevel >= ERROR ||
279 should_output_to_server(elevel) ||
281 return true;
282 return false;
283}

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_printf()

int int int pg_attribute_printf ( ,
 
)

◆ pg_re_throw()

pg_noreturn void pg_re_throw ( void  )

Definition at line 2021 of file elog.c.

2022{
2023 /* If possible, throw the error to the next outer setjmp handler */
2024 if (PG_exception_stack != NULL)
2025 siglongjmp(*PG_exception_stack, 1);
2026 else
2027 {
2028 /*
2029 * If we get here, elog(ERROR) was thrown inside a PG_TRY block, which
2030 * we have now exited only to discover that there is no outer setjmp
2031 * handler to pass the error to. Had the error been thrown outside
2032 * the block to begin with, we'd have promoted the error to FATAL, so
2033 * the correct behavior is to make it FATAL now; that is, emit it and
2034 * then call proc_exit.
2035 */
2037
2039 Assert(edata->elevel == ERROR);
2040 edata->elevel = FATAL;
2041
2042 /*
2043 * At least in principle, the increase in severity could have changed
2044 * where-to-output decisions, so recalculate.
2045 */
2048
2049 /*
2050 * We can use errfinish() for the rest, but we don't want it to call
2051 * any error context routines a second time. Since we know we are
2052 * about to exit, it should be OK to just clear the context stack.
2053 */
2054 error_context_stack = NULL;
2055
2056 errfinish(edata->filename, edata->lineno, edata->funcname);
2057 }
2058
2059 /* Doesn't return ... */
2060 ExceptionalCondition("pg_re_throw tried to return", __FILE__, __LINE__);
2061}
void ExceptionalCondition(const char *conditionName, const char *fileName, int lineNumber)
Definition: assert.c:30
int lineno
Definition: elog.h:427

References Assert(), ErrorData::elevel, errfinish(), ERROR, error_context_stack, errordata, errordata_stack_depth, ExceptionalCondition(), FATAL, ErrorData::filename, ErrorData::funcname, ErrorData::lineno, ErrorData::output_to_client, ErrorData::output_to_server, 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 1662 of file elog.c.

1663{
1664 /* Save errno before evaluation of argument functions can change it */
1665 save_format_errnumber = errnumber;
1666 /* Save caller's text domain */
1667 save_format_domain = domain;
1668}
static int save_format_errnumber
Definition: elog.c:1658
static const char * save_format_domain
Definition: elog.c:1659

References save_format_domain, and save_format_errnumber.

◆ reset_formatted_start_time()

void reset_formatted_start_time ( void  )

Definition at line 2716 of file elog.c.

2717{
2718 formatted_start_time[0] = '\0';
2719}

References formatted_start_time.

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

◆ ReThrowError()

pg_noreturn void ReThrowError ( ErrorData edata)

Definition at line 1971 of file elog.c.

1972{
1973 ErrorData *newedata;
1974
1975 Assert(edata->elevel == ERROR);
1976
1977 /* Push the data back into the error context */
1980
1981 newedata = get_error_stack_entry();
1982 memcpy(newedata, edata, sizeof(ErrorData));
1983
1984 /* Make copies of separately-allocated fields */
1985 if (newedata->message)
1986 newedata->message = pstrdup(newedata->message);
1987 if (newedata->detail)
1988 newedata->detail = pstrdup(newedata->detail);
1989 if (newedata->detail_log)
1990 newedata->detail_log = pstrdup(newedata->detail_log);
1991 if (newedata->hint)
1992 newedata->hint = pstrdup(newedata->hint);
1993 if (newedata->context)
1994 newedata->context = pstrdup(newedata->context);
1995 if (newedata->backtrace)
1996 newedata->backtrace = pstrdup(newedata->backtrace);
1997 if (newedata->schema_name)
1998 newedata->schema_name = pstrdup(newedata->schema_name);
1999 if (newedata->table_name)
2000 newedata->table_name = pstrdup(newedata->table_name);
2001 if (newedata->column_name)
2002 newedata->column_name = pstrdup(newedata->column_name);
2003 if (newedata->datatype_name)
2004 newedata->datatype_name = pstrdup(newedata->datatype_name);
2005 if (newedata->constraint_name)
2006 newedata->constraint_name = pstrdup(newedata->constraint_name);
2007 if (newedata->internalquery)
2008 newedata->internalquery = pstrdup(newedata->internalquery);
2009
2010 /* Reset the assoc_context to be ErrorContext */
2011 newedata->assoc_context = ErrorContext;
2012
2014 PG_RE_THROW();
2015}

References Assert(), ErrorData::assoc_context, ErrorData::backtrace, ErrorData::column_name, ErrorData::constraint_name, ErrorData::context, ErrorData::datatype_name, ErrorData::detail, ErrorData::detail_log, ErrorData::elevel, ERROR, ErrorContext, get_error_stack_entry(), ErrorData::hint, ErrorData::internalquery, MemoryContextSwitchTo(), ErrorData::message, PG_RE_THROW, pstrdup(), recursion_depth, ErrorData::schema_name, and ErrorData::table_name.

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

◆ set_errcontext_domain()

int set_errcontext_domain ( const char *  domain)

Definition at line 1425 of file elog.c.

1426{
1428
1429 /* we don't bother incrementing recursion_depth */
1431
1432 /* the default text domain is the backend's */
1433 edata->context_domain = domain ? domain : PG_TEXTDOMAIN("postgres");
1434
1435 return 0; /* return value does not matter */
1436}
#define PG_TEXTDOMAIN(domain)
Definition: c.h:1202

References CHECK_STACK_DEPTH, ErrorData::context_domain, errordata, errordata_stack_depth, and PG_TEXTDOMAIN.

◆ ThrowErrorData()

void ThrowErrorData ( ErrorData edata)

Definition at line 1912 of file elog.c.

1913{
1914 ErrorData *newedata;
1915 MemoryContext oldcontext;
1916
1917 if (!errstart(edata->elevel, edata->domain))
1918 return; /* error is not to be reported at all */
1919
1920 newedata = &errordata[errordata_stack_depth];
1922 oldcontext = MemoryContextSwitchTo(newedata->assoc_context);
1923
1924 /* Copy the supplied fields to the error stack entry. */
1925 if (edata->sqlerrcode != 0)
1926 newedata->sqlerrcode = edata->sqlerrcode;
1927 if (edata->message)
1928 newedata->message = pstrdup(edata->message);
1929 if (edata->detail)
1930 newedata->detail = pstrdup(edata->detail);
1931 if (edata->detail_log)
1932 newedata->detail_log = pstrdup(edata->detail_log);
1933 if (edata->hint)
1934 newedata->hint = pstrdup(edata->hint);
1935 if (edata->context)
1936 newedata->context = pstrdup(edata->context);
1937 if (edata->backtrace)
1938 newedata->backtrace = pstrdup(edata->backtrace);
1939 /* assume message_id is not available */
1940 if (edata->schema_name)
1941 newedata->schema_name = pstrdup(edata->schema_name);
1942 if (edata->table_name)
1943 newedata->table_name = pstrdup(edata->table_name);
1944 if (edata->column_name)
1945 newedata->column_name = pstrdup(edata->column_name);
1946 if (edata->datatype_name)
1947 newedata->datatype_name = pstrdup(edata->datatype_name);
1948 if (edata->constraint_name)
1949 newedata->constraint_name = pstrdup(edata->constraint_name);
1950 newedata->cursorpos = edata->cursorpos;
1951 newedata->internalpos = edata->internalpos;
1952 if (edata->internalquery)
1953 newedata->internalquery = pstrdup(edata->internalquery);
1954
1955 MemoryContextSwitchTo(oldcontext);
1957
1958 /* Process the error. */
1959 errfinish(edata->filename, edata->lineno, edata->funcname);
1960}

References ErrorData::assoc_context, ErrorData::backtrace, ErrorData::column_name, ErrorData::constraint_name, ErrorData::context, ErrorData::cursorpos, ErrorData::datatype_name, ErrorData::detail, ErrorData::detail_log, ErrorData::domain, ErrorData::elevel, errfinish(), errordata, errordata_stack_depth, errstart(), ErrorData::filename, ErrorData::funcname, ErrorData::hint, ErrorData::internalpos, ErrorData::internalquery, ErrorData::lineno, MemoryContextSwitchTo(), ErrorData::message, pstrdup(), recursion_depth, ErrorData::schema_name, ErrorData::sqlerrcode, and ErrorData::table_name.

Referenced by ProcessParallelMessage(), and text_to_stavalues().

◆ unpack_sql_state()

char * unpack_sql_state ( int  sql_state)

Definition at line 3222 of file elog.c.

3223{
3224 static char buf[12];
3225 int i;
3226
3227 for (i = 0; i < 5; i++)
3228 {
3229 buf[i] = PGUNSIXBIT(sql_state);
3230 sql_state >>= 6;
3231 }
3232
3233 buf[i] = '\0';
3234 return buf;
3235}
#define PGUNSIXBIT(val)
Definition: elog.h:54

References buf, 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 void vwrite_stderr ( const char *  fmt,
va_list  ap 
)

◆ write_csvlog()

void write_csvlog ( ErrorData edata)

Definition at line 63 of file csvlog.c.

64{
66 bool print_stmt = false;
67
68 /* static counter for line numbers */
69 static long log_line_number = 0;
70
71 /* has counter been reset in current process? */
72 static int log_my_pid = 0;
73
74 /*
75 * This is one of the few places where we'd rather not inherit a static
76 * variable's value from the postmaster. But since we will, reset it when
77 * MyProcPid changes.
78 */
79 if (log_my_pid != MyProcPid)
80 {
81 log_line_number = 0;
82 log_my_pid = MyProcPid;
84 }
85 log_line_number++;
86
88
89 /* timestamp with milliseconds */
92
93 /* username */
94 if (MyProcPort)
97
98 /* database name */
99 if (MyProcPort)
102
103 /* Process id */
104 if (MyProcPid != 0)
107
108 /* Remote host and port */
110 {
113 if (MyProcPort->remote_port && MyProcPort->remote_port[0] != '\0')
114 {
117 }
119 }
121
122 /* session id */
123 appendStringInfo(&buf, "%" PRIx64 ".%x", MyStartTime, MyProcPid);
125
126 /* Line number */
127 appendStringInfo(&buf, "%ld", log_line_number);
129
130 /* PS display */
131 if (MyProcPort)
132 {
133 StringInfoData msgbuf;
134 const char *psdisp;
135 int displen;
136
137 initStringInfo(&msgbuf);
138
139 psdisp = get_ps_display(&displen);
140 appendBinaryStringInfo(&msgbuf, psdisp, displen);
141 appendCSVLiteral(&buf, msgbuf.data);
142
143 pfree(msgbuf.data);
144 }
146
147 /* session start timestamp */
150
151 /* Virtual transaction id */
152 /* keep VXID format in sync with lockfuncs.c */
156
157 /* Transaction id */
160
161 /* Error severity */
164
165 /* SQL state code */
168
169 /* errmessage */
170 appendCSVLiteral(&buf, edata->message);
172
173 /* errdetail or errdetail_log */
174 if (edata->detail_log)
176 else
177 appendCSVLiteral(&buf, edata->detail);
179
180 /* errhint */
181 appendCSVLiteral(&buf, edata->hint);
183
184 /* internal query */
187
188 /* if printed internal query, print internal pos too */
189 if (edata->internalpos > 0 && edata->internalquery != NULL)
190 appendStringInfo(&buf, "%d", edata->internalpos);
192
193 /* errcontext */
194 if (!edata->hide_ctx)
195 appendCSVLiteral(&buf, edata->context);
197
198 /* user query --- only reported if not disabled by the caller */
199 print_stmt = check_log_of_query(edata);
200 if (print_stmt)
203 if (print_stmt && edata->cursorpos > 0)
204 appendStringInfo(&buf, "%d", edata->cursorpos);
206
207 /* file error location */
209 {
210 StringInfoData msgbuf;
211
212 initStringInfo(&msgbuf);
213
214 if (edata->funcname && edata->filename)
215 appendStringInfo(&msgbuf, "%s, %s:%d",
216 edata->funcname, edata->filename,
217 edata->lineno);
218 else if (edata->filename)
219 appendStringInfo(&msgbuf, "%s:%d",
220 edata->filename, edata->lineno);
221 appendCSVLiteral(&buf, msgbuf.data);
222 pfree(msgbuf.data);
223 }
225
226 /* application name */
229
231
232 /* backend type */
235
236 /* leader PID */
237 if (MyProc)
238 {
239 PGPROC *leader = MyProc->lockGroupLeader;
240
241 /*
242 * Show the leader only for active parallel workers. This leaves out
243 * the leader of a parallel group.
244 */
245 if (leader && leader->pid != MyProcPid)
246 appendStringInfo(&buf, "%d", leader->pid);
247 }
249
250 /* query id */
252
254
255 /* If in the syslogger process, try to write messages direct to file */
256 if (MyBackendType == B_LOGGER)
258 else
260
261 pfree(buf.data);
262}
static void appendCSVLiteral(StringInfo buf, const char *data)
Definition: csvlog.c:37
bool check_log_of_query(ErrorData *edata)
Definition: elog.c:2752
const char * error_severity(int elevel)
Definition: elog.c:3723
int Log_error_verbosity
Definition: elog.c:109
void write_pipe_chunks(char *data, int len, int dest)
Definition: elog.c:3482
@ PGERROR_VERBOSE
Definition: elog.h:474
#define LOG_DESTINATION_CSVLOG
Definition: elog.h:488
@ B_LOGGER
Definition: miscadmin.h:374
void initStringInfo(StringInfo str)
Definition: stringinfo.c:97
void write_syslogger_file(const char *buffer, int count, int destination)
Definition: syslogger.c:1093

References _, appendBinaryStringInfo(), appendCSVLiteral(), appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), application_name, B_LOGGER, buf, check_log_of_query(), ErrorData::context, ErrorData::cursorpos, StringInfoData::data, Port::database_name, debug_query_string, ErrorData::detail, ErrorData::detail_log, ErrorData::elevel, error_severity(), ErrorData::filename, ErrorData::funcname, get_backend_type_for_log(), get_formatted_log_time(), get_formatted_start_time(), get_ps_display(), GetTopTransactionIdIfAny(), ErrorData::hide_ctx, ErrorData::hint, initStringInfo(), ErrorData::internalpos, ErrorData::internalquery, INVALID_PROC_NUMBER, ErrorData::lineno, PGPROC::lockGroupLeader, LOG_DESTINATION_CSVLOG, Log_error_verbosity, PGPROC::lxid, ErrorData::message, MyBackendType, MyProc, MyProcPid, MyProcPort, MyStartTime, pfree(), PGERROR_VERBOSE, pgstat_get_my_query_id(), PGPROC::pid, PGPROC::procNumber, Port::remote_host, Port::remote_port, reset_formatted_start_time(), ErrorData::sqlerrcode, unpack_sql_state(), Port::user_name, PGPROC::vxid, write_pipe_chunks(), and write_syslogger_file().

Referenced by send_message_to_server_log().

◆ write_jsonlog()

void write_jsonlog ( ErrorData edata)

Definition at line 109 of file jsonlog.c.

110{
112 char *start_time;
113 char *log_time;
114
115 /* static counter for line numbers */
116 static long log_line_number = 0;
117
118 /* Has the counter been reset in the current process? */
119 static int log_my_pid = 0;
120
121 /*
122 * This is one of the few places where we'd rather not inherit a static
123 * variable's value from the postmaster. But since we will, reset it when
124 * MyProcPid changes.
125 */
126 if (log_my_pid != MyProcPid)
127 {
128 log_line_number = 0;
129 log_my_pid = MyProcPid;
131 }
132 log_line_number++;
133
135
136 /* Initialize string */
138
139 /* timestamp with milliseconds */
140 log_time = get_formatted_log_time();
141
142 /*
143 * First property does not use appendJSONKeyValue as it does not have
144 * comma prefix.
145 */
146 escape_json(&buf, "timestamp");
148 escape_json(&buf, log_time);
149
150 /* username */
151 if (MyProcPort)
152 appendJSONKeyValue(&buf, "user", MyProcPort->user_name, true);
153
154 /* database name */
155 if (MyProcPort)
157
158 /* Process ID */
159 if (MyProcPid != 0)
160 appendJSONKeyValueFmt(&buf, "pid", false, "%d", MyProcPid);
161
162 /* Remote host and port */
164 {
165 appendJSONKeyValue(&buf, "remote_host", MyProcPort->remote_host, true);
166 if (MyProcPort->remote_port && MyProcPort->remote_port[0] != '\0')
167 appendJSONKeyValue(&buf, "remote_port", MyProcPort->remote_port, false);
168 }
169
170 /* Session id */
171 appendJSONKeyValueFmt(&buf, "session_id", true, "%" PRIx64 ".%x",
173
174 /* Line number */
175 appendJSONKeyValueFmt(&buf, "line_num", false, "%ld", log_line_number);
176
177 /* PS display */
178 if (MyProcPort)
179 {
180 StringInfoData msgbuf;
181 const char *psdisp;
182 int displen;
183
184 initStringInfo(&msgbuf);
185 psdisp = get_ps_display(&displen);
186 appendBinaryStringInfo(&msgbuf, psdisp, displen);
187 appendJSONKeyValue(&buf, "ps", msgbuf.data, true);
188
189 pfree(msgbuf.data);
190 }
191
192 /* session start timestamp */
194 appendJSONKeyValue(&buf, "session_start", start_time, true);
195
196 /* Virtual transaction id */
197 /* keep VXID format in sync with lockfuncs.c */
199 appendJSONKeyValueFmt(&buf, "vxid", true, "%d/%u",
201
202 /* Transaction id */
203 appendJSONKeyValueFmt(&buf, "txid", false, "%u",
205
206 /* Error severity */
207 if (edata->elevel)
208 appendJSONKeyValue(&buf, "error_severity",
209 error_severity(edata->elevel), true);
210
211 /* SQL state code */
212 if (edata->sqlerrcode)
213 appendJSONKeyValue(&buf, "state_code",
214 unpack_sql_state(edata->sqlerrcode), true);
215
216 /* errmessage */
217 appendJSONKeyValue(&buf, "message", edata->message, true);
218
219 /* errdetail or error_detail log */
220 if (edata->detail_log)
221 appendJSONKeyValue(&buf, "detail", edata->detail_log, true);
222 else
223 appendJSONKeyValue(&buf, "detail", edata->detail, true);
224
225 /* errhint */
226 if (edata->hint)
227 appendJSONKeyValue(&buf, "hint", edata->hint, true);
228
229 /* internal query */
230 if (edata->internalquery)
231 appendJSONKeyValue(&buf, "internal_query", edata->internalquery,
232 true);
233
234 /* if printed internal query, print internal pos too */
235 if (edata->internalpos > 0 && edata->internalquery != NULL)
236 appendJSONKeyValueFmt(&buf, "internal_position", false, "%d",
237 edata->internalpos);
238
239 /* errcontext */
240 if (edata->context && !edata->hide_ctx)
241 appendJSONKeyValue(&buf, "context", edata->context, true);
242
243 /* user query --- only reported if not disabled by the caller */
244 if (check_log_of_query(edata))
245 {
246 appendJSONKeyValue(&buf, "statement", debug_query_string, true);
247 if (edata->cursorpos > 0)
248 appendJSONKeyValueFmt(&buf, "cursor_position", false, "%d",
249 edata->cursorpos);
250 }
251
252 /* file error location */
254 {
255 if (edata->funcname)
256 appendJSONKeyValue(&buf, "func_name", edata->funcname, true);
257 if (edata->filename)
258 {
259 appendJSONKeyValue(&buf, "file_name", edata->filename, true);
260 appendJSONKeyValueFmt(&buf, "file_line_num", false, "%d",
261 edata->lineno);
262 }
263 }
264
265 /* Application name */
266 if (application_name && application_name[0] != '\0')
267 appendJSONKeyValue(&buf, "application_name", application_name, true);
268
269 /* backend type */
270 appendJSONKeyValue(&buf, "backend_type", get_backend_type_for_log(), true);
271
272 /* leader PID */
273 if (MyProc)
274 {
275 PGPROC *leader = MyProc->lockGroupLeader;
276
277 /*
278 * Show the leader only for active parallel workers. This leaves out
279 * the leader of a parallel group.
280 */
281 if (leader && leader->pid != MyProcPid)
282 appendJSONKeyValueFmt(&buf, "leader_pid", false, "%d",
283 leader->pid);
284 }
285
286 /* query id */
287 appendJSONKeyValueFmt(&buf, "query_id", false, "%" PRId64,
289
290 /* Finish string */
293
294 /* If in the syslogger process, try to write messages direct to file */
295 if (MyBackendType == B_LOGGER)
297 else
299
300 pfree(buf.data);
301}
#define LOG_DESTINATION_JSONLOG
Definition: elog.h:489
void escape_json(StringInfo buf, const char *str)
Definition: json.c:1604
static void static void appendJSONKeyValue(StringInfo buf, const char *key, const char *value, bool escape_value)
Definition: jsonlog.c:43
static void appendJSONKeyValueFmt(StringInfo buf, const char *key, bool escape_key, const char *fmt,...) pg_attribute_printf(4
Definition: jsonlog.c:70

References appendBinaryStringInfo(), appendJSONKeyValue(), appendJSONKeyValueFmt(), appendStringInfoChar(), application_name, B_LOGGER, buf, check_log_of_query(), ErrorData::context, ErrorData::cursorpos, StringInfoData::data, Port::database_name, debug_query_string, ErrorData::detail, ErrorData::detail_log, ErrorData::elevel, error_severity(), escape_json(), ErrorData::filename, ErrorData::funcname, get_backend_type_for_log(), get_formatted_log_time(), get_formatted_start_time(), get_ps_display(), GetTopTransactionIdIfAny(), ErrorData::hide_ctx, ErrorData::hint, initStringInfo(), ErrorData::internalpos, ErrorData::internalquery, INVALID_PROC_NUMBER, ErrorData::lineno, PGPROC::lockGroupLeader, LOG_DESTINATION_JSONLOG, Log_error_verbosity, PGPROC::lxid, ErrorData::message, MyBackendType, MyProc, MyProcPid, MyProcPort, MyStartTime, pfree(), PGERROR_VERBOSE, pgstat_get_my_query_id(), PGPROC::pid, PGPROC::procNumber, Port::remote_host, Port::remote_port, reset_formatted_start_time(), ErrorData::sqlerrcode, start_time, unpack_sql_state(), Port::user_name, PGPROC::vxid, write_pipe_chunks(), and write_syslogger_file().

Referenced by send_message_to_server_log().

◆ write_pipe_chunks()

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

Definition at line 3482 of file elog.c.

3483{
3485 int fd = fileno(stderr);
3486 int rc;
3487
3488 Assert(len > 0);
3489
3490 p.proto.nuls[0] = p.proto.nuls[1] = '\0';
3491 p.proto.pid = MyProcPid;
3492 p.proto.flags = 0;
3495 else if (dest == LOG_DESTINATION_CSVLOG)
3497 else if (dest == LOG_DESTINATION_JSONLOG)
3499
3500 /* write all but the last chunk */
3501 while (len > PIPE_MAX_PAYLOAD)
3502 {
3503 /* no need to set PIPE_PROTO_IS_LAST yet */
3505 memcpy(p.proto.data, data, PIPE_MAX_PAYLOAD);
3507 (void) rc;
3510 }
3511
3512 /* write the last chunk */
3514 p.proto.len = len;
3515 memcpy(p.proto.data, data, len);
3516 rc = write(fd, &p, PIPE_HEADER_SIZE + len);
3517 (void) rc;
3518}
#define LOG_DESTINATION_STDERR
Definition: elog.h:485
#define write(a, b, c)
Definition: win32.h:14
const void size_t len
const void * data
char data[FLEXIBLE_ARRAY_MEMBER]
Definition: syslogger.h:50
char nuls[2]
Definition: syslogger.h:46
#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, generate_unaccent_rules::dest, fd(), PipeProtoHeader::flags, PipeProtoHeader::len, len, LOG_DESTINATION_CSVLOG, LOG_DESTINATION_JSONLOG, LOG_DESTINATION_STDERR, 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()

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

Variable Documentation

◆ emit_log_hook

PGDLLIMPORT emit_log_hook_type emit_log_hook
extern

Definition at line 106 of file elog.c.

Referenced by EmitErrorReport().

◆ error_context_stack

PGDLLIMPORT ErrorContextCallback* error_context_stack
extern

Definition at line 95 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(), 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().

◆ Log_destination

◆ Log_destination_string

PGDLLIMPORT char* Log_destination_string
extern

Definition at line 112 of file elog.c.

Referenced by PostmasterMain().

◆ Log_error_verbosity

PGDLLIMPORT int Log_error_verbosity
extern

Definition at line 109 of file elog.c.

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

◆ Log_line_prefix

PGDLLIMPORT char* Log_line_prefix
extern

Definition at line 110 of file elog.c.

Referenced by log_line_prefix().

◆ PG_exception_stack

◆ syslog_sequence_numbers

PGDLLIMPORT bool syslog_sequence_numbers
extern

Definition at line 113 of file elog.c.

◆ syslog_split_messages

PGDLLIMPORT bool syslog_split_messages
extern

Definition at line 114 of file elog.c.