PostgreSQL Source Code: src/include/miscadmin.h File Reference (original) (raw)

#include <signal.h>
#include "[datatype/timestamp.h](datatype%5F2timestamp%5F8h%5Fsource.html)"
#include "[pgtime.h](pgtime%5F8h%5Fsource.html)"

Go to the source code of this file.

Macros
#define InvalidPid (-1)
#define INTERRUPTS_PENDING_CONDITION() (unlikely(InterruptPending))
#define CHECK_FOR_INTERRUPTS()
#define INTERRUPTS_CAN_BE_PROCESSED()
#define HOLD_INTERRUPTS() (InterruptHoldoffCount++)
#define RESUME_INTERRUPTS()
#define HOLD_CANCEL_INTERRUPTS() (QueryCancelHoldoffCount++)
#define RESUME_CANCEL_INTERRUPTS()
#define START_CRIT_SECTION() (CritSectionCount++)
#define END_CRIT_SECTION()
#define USE_POSTGRES_DATES 0
#define USE_ISO_DATES 1
#define USE_SQL_DATES 2
#define USE_GERMAN_DATES 3
#define USE_XSD_DATES 4
#define DATEORDER_YMD 0
#define DATEORDER_DMY 1
#define DATEORDER_MDY 2
#define INTSTYLE_POSTGRES 0
#define INTSTYLE_POSTGRES_VERBOSE 1
#define INTSTYLE_SQL_STANDARD 2
#define INTSTYLE_ISO_8601 3
#define MAXTZLEN 10 /* max TZ name len, not counting tr. null */
#define MIN_BAS_VAC_RING_SIZE_KB 128
#define MAX_BAS_VAC_RING_SIZE_KB (16 * 1024 * 1024)
#define STACK_DEPTH_SLOP (512 * 1024)
#define SECURITY_LOCAL_USERID_CHANGE 0x0001
#define SECURITY_RESTRICTED_OPERATION 0x0002
#define SECURITY_NOFORCE_RLS 0x0004
#define BACKEND_NUM_TYPES (B_LOGGER + 1)
#define AmRegularBackendProcess() (MyBackendType == B_BACKEND)
#define AmAutoVacuumLauncherProcess() (MyBackendType == B_AUTOVAC_LAUNCHER)
#define AmAutoVacuumWorkerProcess() (MyBackendType == B_AUTOVAC_WORKER)
#define AmBackgroundWorkerProcess() (MyBackendType == B_BG_WORKER)
#define AmWalSenderProcess() (MyBackendType == B_WAL_SENDER)
#define AmLogicalSlotSyncWorkerProcess() (MyBackendType == B_SLOTSYNC_WORKER)
#define AmArchiverProcess() (MyBackendType == B_ARCHIVER)
#define AmBackgroundWriterProcess() (MyBackendType == B_BG_WRITER)
#define AmCheckpointerProcess() (MyBackendType == B_CHECKPOINTER)
#define AmStartupProcess() (MyBackendType == B_STARTUP)
#define AmWalReceiverProcess() (MyBackendType == B_WAL_RECEIVER)
#define AmWalSummarizerProcess() (MyBackendType == B_WAL_SUMMARIZER)
#define AmWalWriterProcess() (MyBackendType == B_WAL_WRITER)
#define AmIoWorkerProcess() (MyBackendType == B_IO_WORKER)
#define AmSpecialWorkerProcess()
#define IsExternalConnectionBackend(backend_type) (backend_type == B_BACKEND |
#define IsBootstrapProcessingMode() (Mode == BootstrapProcessing)
#define IsInitProcessingMode() (Mode == InitProcessing)
#define IsNormalProcessingMode() (Mode == NormalProcessing)
#define GetProcessingMode() Mode
#define SetProcessingMode(mode)
#define INIT_PG_LOAD_SESSION_LIBS 0x0001
#define INIT_PG_OVERRIDE_ALLOW_CONNS 0x0002
#define INIT_PG_OVERRIDE_ROLE_LOGIN 0x0004
Typedefs
typedef char * pg_stack_base_t
typedef enum BackendType BackendType
typedef enum ProcessingMode ProcessingMode
typedef void(* shmem_request_hook_type) (void)
Enumerations
enum BackendType { B_INVALID = 0 , B_BACKEND, B_DEAD_END_BACKEND, B_AUTOVAC_LAUNCHER, B_AUTOVAC_WORKER, B_BG_WORKER, B_WAL_SENDER, B_SLOTSYNC_WORKER, B_STANDALONE_BACKEND, B_ARCHIVER, B_BG_WRITER, B_CHECKPOINTER, B_IO_WORKER, B_STARTUP, B_WAL_RECEIVER, B_WAL_SUMMARIZER, B_WAL_WRITER, B_LOGGER }
enum ProcessingMode { BootstrapProcessing, InitProcessing, NormalProcessing }
Functions
void ProcessInterrupts (void)
pg_stack_base_t set_stack_base (void)
void restore_stack_base (pg_stack_base_t base)
void check_stack_depth (void)
bool stack_is_too_deep (void)
ssize_t get_stack_depth_rlimit (void)
void PreventCommandIfReadOnly (const char *cmdname)
void PreventCommandIfParallelMode (const char *cmdname)
void PreventCommandDuringRecovery (const char *cmdname)
void InitPostmasterChild (void)
void InitStandaloneProcess (const char *argv0)
void InitProcessLocalLatch (void)
void SwitchToSharedLatch (void)
void SwitchBackToLocalLatch (void)
const char * GetBackendTypeDesc (BackendType backendType)
void SetDatabasePath (const char *path)
void checkDataDir (void)
void SetDataDir (const char *dir)
void ChangeToDataDir (void)
char * GetUserNameFromId (Oid roleid, bool noerr)
Oid GetUserId (void)
Oid GetOuterUserId (void)
Oid GetSessionUserId (void)
bool GetSessionUserIsSuperuser (void)
Oid GetAuthenticatedUserId (void)
void SetAuthenticatedUserId (Oid userid)
void GetUserIdAndSecContext (Oid *userid, int *sec_context)
void SetUserIdAndSecContext (Oid userid, int sec_context)
bool InLocalUserIdChange (void)
bool InSecurityRestrictedOperation (void)
bool InNoForceRLSOperation (void)
void GetUserIdAndContext (Oid *userid, bool *sec_def_context)
void SetUserIdAndContext (Oid userid, bool sec_def_context)
void InitializeSessionUserId (const char *rolename, Oid roleid, bool bypass_login_check)
void InitializeSessionUserIdStandalone (void)
void SetSessionAuthorization (Oid userid, bool is_superuser)
Oid GetCurrentRoleId (void)
void SetCurrentRoleId (Oid roleid, bool is_superuser)
void InitializeSystemUser (const char *authn_id, const char *auth_method)
const char * GetSystemUser (void)
bool superuser (void)
bool superuser_arg (Oid roleid)
void pg_split_opts (char **argv, int *argcp, const char *optstr)
void InitializeMaxBackends (void)
void InitializeFastPathLocks (void)
void InitPostgres (const char *in_dbname, Oid dboid, const char *username, Oid useroid, bits32 flags, char *out_dbname)
void BaseInit (void)
void CreateDataDirLockFile (bool amPostmaster)
void CreateSocketLockFile (const char *socketfile, bool amPostmaster, const char *socketDir)
void TouchSocketLockFiles (void)
void AddToDataDirLockFile (int target_line, const char *str)
bool RecheckDataDirLockFile (void)
void ValidatePgVersion (const char *path)
void process_shared_preload_libraries (void)
void process_session_preload_libraries (void)
void process_shmem_requests (void)
void pg_bindtextdomain (const char *domain)
bool has_rolreplication (Oid roleid)
Size EstimateClientConnectionInfoSpace (void)
void SerializeClientConnectionInfo (Size maxsize, char *start_address)
void RestoreClientConnectionInfo (char *conninfo)
size_t get_hash_memory_limit (void)
Variables
PGDLLIMPORT volatile sig_atomic_t InterruptPending
PGDLLIMPORT volatile sig_atomic_t QueryCancelPending
PGDLLIMPORT volatile sig_atomic_t ProcDiePending
PGDLLIMPORT volatile sig_atomic_t IdleInTransactionSessionTimeoutPending
PGDLLIMPORT volatile sig_atomic_t TransactionTimeoutPending
PGDLLIMPORT volatile sig_atomic_t IdleSessionTimeoutPending
PGDLLIMPORT volatile sig_atomic_t ProcSignalBarrierPending
PGDLLIMPORT volatile sig_atomic_t LogMemoryContextPending
PGDLLIMPORT volatile sig_atomic_t IdleStatsUpdateTimeoutPending
PGDLLIMPORT volatile sig_atomic_t CheckClientConnectionPending
PGDLLIMPORT volatile sig_atomic_t ClientConnectionLost
PGDLLIMPORT volatile uint32 InterruptHoldoffCount
PGDLLIMPORT volatile uint32 QueryCancelHoldoffCount
PGDLLIMPORT volatile uint32 CritSectionCount
PGDLLIMPORT pid_t PostmasterPid
PGDLLIMPORT bool IsPostmasterEnvironment
PGDLLIMPORT bool IsUnderPostmaster
PGDLLIMPORT bool IsBinaryUpgrade
PGDLLIMPORT bool ExitOnAnyError
PGDLLIMPORT char * DataDir
PGDLLIMPORT int data_directory_mode
PGDLLIMPORT int NBuffers
PGDLLIMPORT int MaxBackends
PGDLLIMPORT int MaxConnections
PGDLLIMPORT int max_worker_processes
PGDLLIMPORT int max_parallel_workers
PGDLLIMPORT int commit_timestamp_buffers
PGDLLIMPORT int multixact_member_buffers
PGDLLIMPORT int multixact_offset_buffers
PGDLLIMPORT int notify_buffers
PGDLLIMPORT int serializable_buffers
PGDLLIMPORT int subtransaction_buffers
PGDLLIMPORT int transaction_buffers
PGDLLIMPORT int MyProcPid
PGDLLIMPORT pg_time_t MyStartTime
PGDLLIMPORT TimestampTz MyStartTimestamp
PGDLLIMPORT struct Port * MyProcPort
PGDLLIMPORT struct Latch * MyLatch
PGDLLIMPORT uint8 MyCancelKey []
PGDLLIMPORT int MyCancelKeyLength
PGDLLIMPORT int MyPMChildSlot
PGDLLIMPORT char OutputFileName []
PGDLLIMPORT char my_exec_path []
PGDLLIMPORT char pkglib_path []
PGDLLIMPORT Oid MyDatabaseId
PGDLLIMPORT Oid MyDatabaseTableSpace
PGDLLIMPORT bool MyDatabaseHasLoginEventTriggers
PGDLLIMPORT int DateStyle
PGDLLIMPORT int DateOrder
PGDLLIMPORT int IntervalStyle
PGDLLIMPORT bool enableFsync
PGDLLIMPORT bool allowSystemTableMods
PGDLLIMPORT int work_mem
PGDLLIMPORT double hash_mem_multiplier
PGDLLIMPORT int maintenance_work_mem
PGDLLIMPORT int max_parallel_maintenance_workers
PGDLLIMPORT int VacuumBufferUsageLimit
PGDLLIMPORT int VacuumCostPageHit
PGDLLIMPORT int VacuumCostPageMiss
PGDLLIMPORT int VacuumCostPageDirty
PGDLLIMPORT int VacuumCostLimit
PGDLLIMPORT double VacuumCostDelay
PGDLLIMPORT int VacuumCostBalance
PGDLLIMPORT bool VacuumCostActive
PGDLLIMPORT int max_stack_depth
PGDLLIMPORT char * DatabasePath
PGDLLIMPORT BackendType MyBackendType
PGDLLIMPORT ProcessingMode Mode
PGDLLIMPORT bool IgnoreSystemIndexes
PGDLLIMPORT bool process_shared_preload_libraries_in_progress
PGDLLIMPORT bool process_shared_preload_libraries_done
PGDLLIMPORT bool process_shmem_requests_in_progress
PGDLLIMPORT char * session_preload_libraries_string
PGDLLIMPORT char * shared_preload_libraries_string
PGDLLIMPORT char * local_preload_libraries_string
PGDLLIMPORT shmem_request_hook_type shmem_request_hook

AmArchiverProcess

AmAutoVacuumLauncherProcess

AmAutoVacuumWorkerProcess

AmBackgroundWorkerProcess

AmBackgroundWriterProcess

AmCheckpointerProcess

AmIoWorkerProcess

AmLogicalSlotSyncWorkerProcess

AmRegularBackendProcess

AmSpecialWorkerProcess

#define AmSpecialWorkerProcess ( )

Value:

AmLogicalSlotSyncWorkerProcess())

#define AmAutoVacuumLauncherProcess()

Definition at line 396 of file miscadmin.h.

AmStartupProcess

AmWalReceiverProcess

AmWalSenderProcess

AmWalSummarizerProcess

AmWalWriterProcess

BACKEND_NUM_TYPES

#define BACKEND_NUM_TYPES (B_LOGGER + 1)

CHECK_FOR_INTERRUPTS

#define CHECK_FOR_INTERRUPTS ( )

Value:

do { \

ProcessInterrupts(); \

} while(0)

#define INTERRUPTS_PENDING_CONDITION()

Definition at line 123 of file miscadmin.h.

DATEORDER_DMY

DATEORDER_MDY

DATEORDER_YMD

END_CRIT_SECTION

#define END_CRIT_SECTION ( )

Value:

do { \

CritSectionCount--; \

} while(0)

PGDLLIMPORT volatile uint32 CritSectionCount

Definition at line 152 of file miscadmin.h.

GetProcessingMode

#define GetProcessingMode ( ) Mode

HOLD_CANCEL_INTERRUPTS

HOLD_INTERRUPTS

INIT_PG_LOAD_SESSION_LIBS

#define INIT_PG_LOAD_SESSION_LIBS 0x0001

INIT_PG_OVERRIDE_ALLOW_CONNS

#define INIT_PG_OVERRIDE_ALLOW_CONNS 0x0002

INIT_PG_OVERRIDE_ROLE_LOGIN

#define INIT_PG_OVERRIDE_ROLE_LOGIN 0x0004

INTERRUPTS_CAN_BE_PROCESSED

#define INTERRUPTS_CAN_BE_PROCESSED ( )

Value:

QueryCancelHoldoffCount == 0)

PGDLLIMPORT volatile uint32 InterruptHoldoffCount

Definition at line 130 of file miscadmin.h.

INTERRUPTS_PENDING_CONDITION

INTSTYLE_ISO_8601

#define INTSTYLE_ISO_8601 3

INTSTYLE_POSTGRES

#define INTSTYLE_POSTGRES 0

INTSTYLE_POSTGRES_VERBOSE

#define INTSTYLE_POSTGRES_VERBOSE 1

INTSTYLE_SQL_STANDARD

#define INTSTYLE_SQL_STANDARD 2

InvalidPid

IsBootstrapProcessingMode

IsExternalConnectionBackend

| #define IsExternalConnectionBackend | ( | | backend_type | ) | (backend_type == B_BACKEND || backend_type == B_WAL_SENDER) | | ----------------------------------- | - | | ------------- | - | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

IsInitProcessingMode

IsNormalProcessingMode

MAX_BAS_VAC_RING_SIZE_KB

#define MAX_BAS_VAC_RING_SIZE_KB (16 * 1024 * 1024)

MAXTZLEN

#define MAXTZLEN 10 /* max TZ name len, not counting tr. null */

MIN_BAS_VAC_RING_SIZE_KB

#define MIN_BAS_VAC_RING_SIZE_KB 128

RESUME_CANCEL_INTERRUPTS

#define RESUME_CANCEL_INTERRUPTS ( )

Value:

do { \

QueryCancelHoldoffCount--; \

} while(0)

PGDLLIMPORT volatile uint32 QueryCancelHoldoffCount

Definition at line 144 of file miscadmin.h.

RESUME_INTERRUPTS

#define RESUME_INTERRUPTS ( )

Value:

do { \

InterruptHoldoffCount--; \

} while(0)

Definition at line 136 of file miscadmin.h.

SECURITY_LOCAL_USERID_CHANGE

#define SECURITY_LOCAL_USERID_CHANGE 0x0001

SECURITY_NOFORCE_RLS

#define SECURITY_NOFORCE_RLS 0x0004

SECURITY_RESTRICTED_OPERATION

#define SECURITY_RESTRICTED_OPERATION 0x0002

SetProcessingMode

| #define SetProcessingMode | ( | | mode | ) | | ------------------------- | - | | --------------------------------------------------------------------- | - |

Value:

do { \

} while(0)

static PgChecksumMode mode

Definition at line 483 of file miscadmin.h.

STACK_DEPTH_SLOP

#define STACK_DEPTH_SLOP (512 * 1024)

START_CRIT_SECTION

USE_GERMAN_DATES

#define USE_GERMAN_DATES 3

USE_ISO_DATES

USE_POSTGRES_DATES

#define USE_POSTGRES_DATES 0

USE_SQL_DATES

USE_XSD_DATES

BackendType

pg_stack_base_t

ProcessingMode

shmem_request_hook_type

typedef void(* shmem_request_hook_type) (void)

BackendType

Enumerator
B_INVALID
B_BACKEND
B_DEAD_END_BACKEND
B_AUTOVAC_LAUNCHER
B_AUTOVAC_WORKER
B_BG_WORKER
B_WAL_SENDER
B_SLOTSYNC_WORKER
B_STANDALONE_BACKEND
B_ARCHIVER
B_BG_WRITER
B_CHECKPOINTER
B_IO_WORKER
B_STARTUP
B_WAL_RECEIVER
B_WAL_SUMMARIZER
B_WAL_WRITER
B_LOGGER

Definition at line 337 of file miscadmin.h.

338{

340

341

349

351

352

353

354

355

356

357

358

359

360

369

370

371

372

373

ProcessingMode

Enumerator
BootstrapProcessing
InitProcessing
NormalProcessing

Definition at line 468 of file miscadmin.h.

AddToDataDirLockFile()

void AddToDataDirLockFile ( int target_line,
const char * str
)

Definition at line 1519 of file miscinit.c.

1520{

1521 int fd;

1522 int len;

1523 int lineno;

1524 char *srcptr;

1525 char *destptr;

1526 char srcbuffer[BLCKSZ];

1527 char destbuffer[BLCKSZ];

1528

1530 if (fd < 0)

1531 {

1534 errmsg("could not open file \"%s\": %m",

1536 return;

1537 }

1539 len = read(fd, srcbuffer, sizeof(srcbuffer) - 1);

1541 if (len < 0)

1542 {

1545 errmsg("could not read from file \"%s\": %m",

1548 return;

1549 }

1550 srcbuffer[len] = '\0';

1551

1552

1553

1554

1555

1556 srcptr = srcbuffer;

1557 for (lineno = 1; lineno < target_line; lineno++)

1558 {

1559 char *eol = strchr(srcptr, '\n');

1560

1561 if (eol == NULL)

1562 break;

1563 srcptr = eol + 1;

1564 }

1565 memcpy(destbuffer, srcbuffer, srcptr - srcbuffer);

1566 destptr = destbuffer + (srcptr - srcbuffer);

1567

1568

1569

1570

1571

1572 for (; lineno < target_line; lineno++)

1573 {

1574 if (destptr < destbuffer + sizeof(destbuffer))

1575 *destptr++ = '\n';

1576 }

1577

1578

1579

1580

1581 snprintf(destptr, destbuffer + sizeof(destbuffer) - destptr, "%s\n", str);

1582 destptr += strlen(destptr);

1583

1584

1585

1586

1587 if ((srcptr = strchr(srcptr, '\n')) != NULL)

1588 {

1589 srcptr++;

1590 snprintf(destptr, destbuffer + sizeof(destbuffer) - destptr, "%s",

1591 srcptr);

1592 }

1593

1594

1595

1596

1597

1598 len = strlen(destbuffer);

1599 errno = 0;

1602 {

1604

1605 if (errno == 0)

1606 errno = ENOSPC;

1609 errmsg("could not write to file \"%s\": %m",

1612 return;

1613 }

1617 {

1620 errmsg("could not write to file \"%s\": %m",

1622 }

1625 {

1628 errmsg("could not write to file \"%s\": %m",

1630 }

1631}

int errcode_for_file_access(void)

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

#define ereport(elevel,...)

#define DIRECTORY_LOCK_FILE

static int fd(const char *x, int i)

static void pgstat_report_wait_start(uint32 wait_event_info)

static void pgstat_report_wait_end(void)

References close, DIRECTORY_LOCK_FILE, ereport, errcode_for_file_access(), errmsg(), fd(), len, LOG, PG_BINARY, pg_fsync(), pg_pwrite, pgstat_report_wait_end(), pgstat_report_wait_start(), read, snprintf, and str.

Referenced by InternalIpcMemoryCreate(), PostmasterMain(), process_pm_child_exit(), process_pm_pmsignal(), and process_pm_shutdown_request().

BaseInit()

Definition at line 607 of file postinit.c.

608{

610

611

612

613

615

616

617

618

619

621

622

623

624

625

626

627

629

630

631

632

633

635

636

640

641

642

643

644

646

647

648

649

650

652

653

655

656

657

658

659

661}

void pgaio_init_backend(void)

void InitBufferManagerAccess(void)

void InitFileAccess(void)

void InitTemporaryFileAccess(void)

Assert(PointerIsAligned(start, uint64))

void InitLockManagerAccess(void)

void pgstat_initialize(void)

void ReplicationSlotInitialize(void)

void InitXLogInsert(void)

References Assert(), DebugFileOpen(), InitBufferManagerAccess(), InitFileAccess(), InitLockManagerAccess(), InitSync(), InitTemporaryFileAccess(), InitXLogInsert(), MyProc, pgaio_init_backend(), pgstat_initialize(), ReplicationSlotInitialize(), and smgrinit().

Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), AuxiliaryProcessMainCommon(), BackgroundWorkerMain(), BootstrapModeMain(), PostgresMain(), and ReplSlotSyncWorkerMain().

ChangeToDataDir()

void ChangeToDataDir ( void )

check_stack_depth()

void check_stack_depth ( void )

Definition at line 95 of file stack_depth.c.

96{

98 {

100 (errcode(ERRCODE_STATEMENT_TOO_COMPLEX),

101 errmsg("stack depth limit exceeded"),

102 errhint("Increase the configuration parameter \"max_stack_depth\" (currently %dkB), "

103 "after ensuring the platform's stack depth limit is adequate.",

105 }

106}

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

int errcode(int sqlerrcode)

bool stack_is_too_deep(void)

References ereport, errcode(), errhint(), errmsg(), ERROR, max_stack_depth, and stack_is_too_deep().

Referenced by _jumbleNode(), AlterTypeRecurse(), apply_scanjoin_target_to_paths(), ATAddCheckNNConstraint(), ATExecAddColumn(), ATExecAlterConstrDeferrability(), ATExecAlterConstrEnforceability(), ATExecDropColumn(), ATExecSetNotNull(), CheckAttributeType(), checkCond(), clean_NOT_intree(), clean_stopword_intree(), cntsize(), contains_required_value(), convertJsonbValue(), copyObjectImpl(), Cover(), create_plan_recurse(), datum_to_json_internal(), datum_to_jsonb_internal(), dofindsubquery(), dropconstraint_internal(), emit_jsp_gin_entries(), equal(), eval_const_expressions_mutator(), EventTriggerInvoke(), ExecEndNode(), ExecEvalSubPlan(), ExecInitExprRec(), ExecInitNode(), ExecMakeFunctionResultSet(), ExecProcNodeFirst(), ExecShutdownNode_walker(), execute(), executeAnyItem(), executeBoolItem(), executeItemOptUnwrapTarget(), expand_partitioned_rtentry(), expression_tree_mutator_impl(), expression_tree_walker_impl(), extract_jsp_bool_expr(), fillQT(), find_composite_type_dependencies(), find_matching_subplans_recurse(), findDependentObjects(), findoprnd(), findoprnd_recurse(), flatten_grouping_sets(), flattenJsonPathParseItem(), FreePageManagerDumpBtree(), freetree(), generate_partition_qual(), generate_partitionwise_join_paths(), get_query_def(), get_rels_with_domain(), get_rule_expr(), get_setop_query(), get_steps_using_prefix_recurse(), gistSplit(), hash_range(), hash_range_extended(), hash_record(), hash_record_extended(), hk_depth_search(), infix(), inline_function_in_from(), int_query_opr_selec(), is_simple_union_all_recurse(), JsonbDeepContains(), lseg_inside_poly(), ltree_execute(), makepol(), maketree(), MatchText(), MultiExecProcNode(), outNode(), p_ishost(), p_isURLPath(), parse_array(), parse_object(), parseNodeString(), plainnode(), planstate_tree_walker_impl(), plperl_hash_from_tuple(), plperl_sv_to_datum(), PLy_input_setup_func(), PLy_output_setup_func(), populate_array_dim_jsonb(), populate_record_field(), printJsonPathItem(), pull_up_sublinks_jointree_recurse(), pull_up_subqueries_recurse(), QT2QTN(), QTNBinary(), QTNClearFlags(), QTNCopy(), QTNFree(), QTNodeCompare(), QTNSort(), QTNTernary(), range_cmp(), range_in(), range_out(), range_recv(), range_send(), raw_expression_tree_walker_impl(), record_cmp(), record_eq(), record_in(), record_out(), record_recv(), record_send(), recurse_set_operations(), regex_selectivity_sub(), relation_is_updatable(), resolve_special_varno(), set_append_rel_size(), setPath(), split_array(), SplitToVariants(), standard_ProcessUtility(), transformExprRecurse(), transformFromClauseItem(), transformSetOperationTree(), traverse_lacons(), try_partitionwise_join(), TS_execute_locations_recurse(), TS_execute_recurse(), TS_phrase_execute(), tsquery_opr_selec(), and tsquery_requires_match().

checkDataDir()

void checkDataDir ( void )

Definition at line 296 of file miscinit.c.

297{

298 struct stat stat_buf;

299

301

303 {

304 if (errno == ENOENT)

307 errmsg("data directory \"%s\" does not exist",

309 else

312 errmsg("could not read permissions of directory \"%s\": %m",

314 }

315

316

317 if (S\_ISDIR(stat_buf.st_mode))

319 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),

320 errmsg("specified data directory \"%s\" is not a directory",

322

323

324

325

326

327

328

329

330

331

332#if !defined(WIN32) && !defined(__CYGWIN__)

333 if (stat_buf.st_uid != geteuid())

335 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),

336 errmsg("data directory \"%s\" has wrong ownership",

338 errhint("The server must be started by the user that owns the data directory.")));

339#endif

340

341

342

343

344

345

346

347

348

349

350

351

352#if !defined(WIN32) && !defined(__CYGWIN__)

355 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),

356 errmsg("data directory \"%s\" has invalid permissions",

358 errdetail("Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).")));

359#endif

360

361

362

363

364

365

366

367

368

369

370

371

372

373#if !defined(WIN32) && !defined(__CYGWIN__)

375

378#endif

379

380

382}

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

void SetDataDirectoryCreatePerm(int dataDirMode)

#define PG_MODE_MASK_GROUP

void ValidatePgVersion(const char *path)

References Assert(), data_directory_mode, DataDir, ereport, errcode(), errcode_for_file_access(), errdetail(), errhint(), errmsg(), FATAL, pg_dir_create_mode, pg_mode_mask, PG_MODE_MASK_GROUP, S_ISDIR, SetDataDirectoryCreatePerm(), stat::st_mode, stat::st_uid, stat, and ValidatePgVersion().

Referenced by BootstrapModeMain(), PostgresSingleUserMain(), and PostmasterMain().

CreateDataDirLockFile()

void CreateDataDirLockFile ( bool amPostmaster )

CreateSocketLockFile()

void CreateSocketLockFile ( const char * socketfile,
bool amPostmaster,
const char * socketDir
)

EstimateClientConnectionInfoSpace()

Size EstimateClientConnectionInfoSpace ( void )

get_hash_memory_limit()

size_t get_hash_memory_limit ( void )

Definition at line 3621 of file nodeHash.c.

3622{

3623 double mem_limit;

3624

3625

3627

3628

3629 mem_limit = Min(mem_limit, (double) SIZE_MAX);

3630

3631 return (size_t) mem_limit;

3632}

double hash_mem_multiplier

References hash_mem_multiplier, Min, and work_mem.

Referenced by consider_groupingsets_paths(), cost_memoize_rescan(), create_setop_path(), ExecChooseHashTableSize(), ExecInitMemoize(), ExecParallelHashIncreaseNumBatches(), final_cost_hashjoin(), hash_agg_set_limits(), hash_choose_num_partitions(), subpath_is_hashable(), and subplan_is_hashable().

get_stack_depth_rlimit()

ssize_t get_stack_depth_rlimit ( void )

Definition at line 176 of file stack_depth.c.

177{

178#if defined(HAVE_GETRLIMIT)

179 static ssize_t val = 0;

180

181

182 if (val == 0)

183 {

184 struct rlimit rlim;

185

186 if (getrlimit(RLIMIT_STACK, &rlim) < 0)

187 val = -1;

188 else if (rlim.rlim_cur == RLIM_INFINITY)

189 val = SSIZE_MAX;

190

191 else if (rlim.rlim_cur >= SSIZE_MAX)

192 val = SSIZE_MAX;

193 else

194 val = rlim.rlim_cur;

195 }

196 return val;

197#else

198

199 return WIN32_STACK_RLIMIT;

200#endif

201}

References val.

Referenced by check_max_stack_depth(), and InitializeGUCOptionsFromEnvironment().

GetAuthenticatedUserId()

Oid GetAuthenticatedUserId ( void )

GetBackendTypeDesc()

const char * GetBackendTypeDesc ( BackendType backendType )

Definition at line 263 of file miscinit.c.

264{

265 const char *backendDesc = gettext_noop("unknown process type");

266

267 switch (backendType)

268 {

269#define PG_PROCTYPE(bktype, description, main_func, shmem_attach) \

270 case bktype: backendDesc = description; break;

272#undef PG_PROCTYPE

273 }

274 return backendDesc;

275}

References gettext_noop.

Referenced by BackendInitialize(), BackendStartup(), CleanupBackend(), CountChildren(), get_backend_type_for_log(), init_ps_display(), pg_stat_get_activity(), pg_stat_io_build_tuples(), and signal_child().

GetCurrentRoleId()

Oid GetCurrentRoleId ( void )

GetOuterUserId()

Oid GetOuterUserId ( void )

GetSessionUserId()

Oid GetSessionUserId ( void )

Definition at line 508 of file miscinit.c.

References Assert(), OidIsValid, and SessionUserId.

Referenced by check_role(), check_session_authorization(), DropRole(), get_rolespec_oid(), get_rolespec_tuple(), InitializeParallelDSM(), InitPostgres(), pgstat_bestart_final(), RenameRole(), and session_user().

GetSessionUserIsSuperuser()

bool GetSessionUserIsSuperuser ( void )

GetSystemUser()

const char * GetSystemUser ( void )

GetUserId()

Definition at line 469 of file miscinit.c.

References Assert(), CurrentUserId, and OidIsValid.

Referenced by AfterTriggerSaveEvent(), AggregateCreate(), all_rows_selectable(), AlterCollation(), AlterDatabase(), AlterDatabaseOwner(), AlterDatabaseRefreshColl(), AlterDatabaseSet(), AlterEventTrigger(), AlterEventTriggerOwner_internal(), AlterExtensionNamespace(), AlterForeignServer(), AlterForeignServerOwner_internal(), AlterFunction(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterOperator(), AlterOpFamilyAdd(), AlterPublication(), AlterPublicationOwner_internal(), AlterRole(), AlterRoleSet(), AlterSchemaOwner_internal(), AlterStatistics(), AlterSubscription(), AlterSubscriptionOwner_internal(), AlterSystemSetConfigFile(), AlterTableMoveAll(), AlterTableSpaceOptions(), AlterTSConfiguration(), AlterTSDictionary(), AlterType(), AlterTypeNamespace_oid(), AlterTypeOwner(), ATExecChangeOwner(), ATPrepAlterColumnType(), ATPrepSetTableSpace(), ATSimplePermissions(), bbsink_server_new(), be_lo_unlink(), binary_upgrade_create_empty_extension(), binary_upgrade_logical_slot_has_caught_up(), brin_desummarize_range(), BuildCachedPlan(), BuildDescForRelation(), BuildIndexValueDescription(), calculate_database_size(), calculate_tablespace_size(), call_pltcl_start_proc(), check_enable_rls(), check_search_path(), check_temp_tablespaces(), CheckCachedPlan(), checkDomainOwner(), checkEnumOwner(), checkFkeyPermissions(), CheckFunctionValidatorAccess(), CheckMyDatabase(), CheckSlotPermissions(), CommentObject(), compile_plperl_function(), compile_pltcl_function(), CompleteCachedPlan(), compute_return_type(), ConfigOptionIsVisible(), convert_and_check_filename(), copy_sequence(), CreateCast(), CreateConversionCommand(), createdb(), CreateEventTrigger(), CreateExtensionInternal(), CreateForeignDataWrapper(), CreateForeignServer(), CreateForeignTable(), CreateFunction(), CreateOpFamily(), CreateProceduralLanguage(), CreatePublication(), CreateRole(), CreateStatistics(), CreateSubscription(), CreateTableSpace(), CreateTransform(), CreateTriggerFiringOn(), current_user(), currtid_internal(), currval_oid(), DefineAggregate(), DefineCollation(), DefineDomain(), DefineEnum(), DefineIndex(), DefineOpClass(), DefineOperator(), DefineOpFamily(), DefineQueryRewrite(), DefineRange(), DefineRelation(), DefineTSConfiguration(), DefineTSDictionary(), DefineType(), DoCopy(), dropdb(), DropOwnedObjects(), DropRole(), DropSubscription(), DropTableSpace(), emit_audit_message(), EnableDisableRule(), ExecAlterDefaultPrivilegesStmt(), ExecAlterExtensionContentsStmt(), ExecAlterExtensionStmt(), ExecAlterObjectDependsStmt(), ExecBuildGroupingEqual(), ExecBuildParamSetEqual(), ExecBuildSlotPartitionKeyDescription(), ExecBuildSlotValueDescription(), ExecCheckOneRelPerms(), ExecCheckpoint(), ExecGetResultRelCheckAsUser(), ExecGrant_Attribute(), ExecGrant_common(), ExecGrant_Largeobject(), ExecGrant_Parameter(), ExecGrant_Relation(), ExecInitAgg(), ExecInitExprRec(), ExecInitFunc(), ExecInitWindowAgg(), ExecReindex(), ExecSecLabelStmt(), execute_extension_script(), ExecuteCallStmt(), ExecuteDoStmt(), ExecuteGrantStmt(), ExecuteTruncateGuts(), extension_is_trusted(), file_fdw_validator(), findRangeCanonicalFunction(), findRangeSubtypeDiffFunction(), FinishPreparedTransaction(), fmgr_security_definer(), get_connect_string(), get_other_operator(), get_rolespec_oid(), get_rolespec_tuple(), get_row_security_policies(), get_tables_to_cluster(), get_tables_to_cluster_partitioned(), GetConfigOptionValues(), gin_clean_pending_list(), GrantRole(), HandleFunctionRequest(), has_any_column_privilege_id(), has_any_column_privilege_name(), has_column_privilege_id_attnum(), has_column_privilege_id_name(), has_column_privilege_name_attnum(), has_column_privilege_name_name(), has_database_privilege_id(), has_database_privilege_name(), has_foreign_data_wrapper_privilege_id(), has_foreign_data_wrapper_privilege_name(), has_function_privilege_id(), has_function_privilege_name(), has_language_privilege_id(), has_language_privilege_name(), has_largeobject_privilege_id(), has_parameter_privilege_name(), has_schema_privilege_id(), has_schema_privilege_name(), has_sequence_privilege_id(), has_sequence_privilege_name(), has_server_privilege_id(), has_server_privilege_name(), has_table_privilege_id(), has_table_privilege_name(), has_tablespace_privilege_id(), has_tablespace_privilege_name(), has_type_privilege_id(), has_type_privilege_name(), have_createdb_privilege(), have_createrole_privilege(), heap_force_common(), ImportForeignSchema(), init_sexpr(), InitializeSearchPath(), InitPostgres(), InitTempTableNamespace(), inline_function(), inline_function_in_from(), insert_username(), interpret_function_parameter_list(), inv_create(), inv_open(), LargeObjectCreate(), lastval(), LockViewRecurse(), LogicalRepSyncTableStart(), lookup_agg_function(), LookupCreationNamespace(), LookupExplicitNamespace(), MergeAttributes(), movedb(), nextval_internal(), OperatorCreate(), OperatorShellMake(), pg_get_sequence_data(), pg_has_role_id(), pg_has_role_name(), pg_import_system_collations(), pg_prewarm(), pg_sequence_last_value(), pg_sequence_parameters(), pg_signal_backend(), pg_stat_get_wal_receiver(), pg_stat_get_wal_senders(), pg_stat_statements_internal(), pgrowlocks(), pgss_store(), pgstat_get_backend_current_activity(), pltcl_fetch_interp(), postgresBeginDirectModify(), postgresBeginForeignScan(), postgresExecForeignTruncate(), postgresGetForeignRelSize(), postgresImportForeignSchema(), PrepareTempTablespaces(), PrepareTransaction(), PublicationAddTables(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForDblink(), RangeVarCallbackForDropRelation(), RangeVarCallbackForLockTable(), RangeVarCallbackForPolicy(), RangeVarCallbackForReindexIndex(), RangeVarCallbackForRenameRule(), RangeVarCallbackForRenameTrigger(), RangeVarCallbackForStats(), RangeVarCallbackMaintainsTable(), RangeVarCallbackOwnsRelation(), RangeVarGetAndCheckCreationNamespace(), ReassignOwnedObjects(), recomputeNamespacePath(), REGRESS_exec_check_perms(), REGRESS_object_access_hook(), REGRESS_object_access_hook_str(), REGRESS_utility_command(), ReindexMultipleInternal(), ReindexMultipleTables(), RemoveObjects(), renameatt_check(), RenameDatabase(), RenameRole(), RenameSchema(), RenameTableSpace(), RenameType(), RevalidateCachedQuery(), RI_Initial_Check(), ri_ReportViolation(), select_perl_context(), set_config_option(), set_foreign_rel_properties(), SetSequence(), shell_check_detail(), superuser(), TargetPrivilegesCheck(), TerminateOtherDBBackends(), transformTableLikeClause(), truncate_check_perms(), user_mapping_ddl_aclcheck(), vacuum_is_permitted_for_relation(), validate_option_array_item(), ValidateJoinEstimator(), ValidateOperatorReference(), and ValidateRestrictionEstimator().

GetUserIdAndContext()

void GetUserIdAndContext ( Oid * userid,
bool * sec_def_context
)

GetUserIdAndSecContext()

void GetUserIdAndSecContext ( Oid * userid,
int * sec_context
)

Definition at line 612 of file miscinit.c.

613{

616}

static int SecurityRestrictionContext

References CurrentUserId, and SecurityRestrictionContext.

Referenced by AfterTriggerExecute(), amcheck_lock_relation_and_check(), ATExecMergePartitions(), ATExecSplitPartition(), brin_summarize_range(), cluster_rel(), ComputeIndexAttrs(), CreateSchemaCommand(), DefineIndex(), do_analyze_rel(), execute_extension_script(), fmgr_security_definer(), index_build(), index_concurrently_build(), InitializeParallelDSM(), PushTransaction(), RefreshMatViewByOid(), reindex_index(), ReindexRelationConcurrently(), ri_PerformCheck(), ri_PlanCheck(), StartTransaction(), SwitchToUntrustedUser(), vacuum_rel(), and validate_index().

GetUserNameFromId()

char * GetUserNameFromId ( Oid roleid,
bool noerr
)

Definition at line 988 of file miscinit.c.

989{

991 char *result;

992

995 {

996 if (!noerr)

998 (errcode(ERRCODE_UNDEFINED_OBJECT),

999 errmsg("invalid role OID: %u", roleid)));

1000 result = NULL;

1001 }

1002 else

1003 {

1006 }

1007 return result;

1008}

#define HeapTupleIsValid(tuple)

static void * GETSTRUCT(const HeapTupleData *tuple)

char * pstrdup(const char *in)

FormData_pg_authid * Form_pg_authid

static Datum ObjectIdGetDatum(Oid X)

void ReleaseSysCache(HeapTuple tuple)

HeapTuple SearchSysCache1(int cacheId, Datum key1)

References ereport, errcode(), errmsg(), ERROR, GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), rolname, and SearchSysCache1().

Referenced by AddRoleMems(), check_can_set_role(), check_object_ownership(), check_role_grantor(), check_role_membership_authorization(), current_user(), DelRoleMems(), DropOwnedObjects(), execute_extension_script(), getObjectDescription(), getObjectIdentityParts(), insert_username(), LogicalRepSyncTableStart(), ReassignOwnedObjects(), regroleout(), session_user(), SwitchToUntrustedUser(), and TargetPrivilegesCheck().

has_rolreplication()

bool has_rolreplication ( Oid roleid )

Definition at line 688 of file miscinit.c.

689{

690 bool result = false;

692

693

695 return true;

696

699 {

702 }

703 return result;

704}

bool superuser_arg(Oid roleid)

References GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), rolreplication, SearchSysCache1(), and superuser_arg().

Referenced by AlterRole(), binary_upgrade_logical_slot_has_caught_up(), CheckSlotPermissions(), CreateRole(), and InitPostgres().

InitializeFastPathLocks()

void InitializeFastPathLocks ( void )

InitializeMaxBackends()

void InitializeMaxBackends ( void )

Definition at line 550 of file postinit.c.

551{

553

554

557

560 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),

561 errmsg("too many server processes configured"),

562 errdetail("\"max_connections\" (%d) plus \"autovacuum_worker_slots\" (%d) plus \"max_worker_processes\" (%d) plus \"max_wal_senders\" (%d) must be less than %d.",

566}

int autovacuum_worker_slots

#define NUM_SPECIAL_WORKER_PROCS

References Assert(), autovacuum_worker_slots, ereport, errcode(), errdetail(), errmsg(), ERROR, MAX_BACKENDS, max_wal_senders, max_worker_processes, MaxBackends, MaxConnections, and NUM_SPECIAL_WORKER_PROCS.

Referenced by BootstrapModeMain(), PostgresSingleUserMain(), and PostmasterMain().

InitializeSessionUserId()

void InitializeSessionUserId ( const char * rolename,
Oid roleid,
bool bypass_login_check
)

Definition at line 710 of file miscinit.c.

712{

715 char *rname;

717

718

719

720

721

722

723

724

726 {

727 Assert(bypass_login_check);

728 return;

729 }

730

731

732

733

734

736

737

738

739

740

741

743

744

745

746

747 if (rolename != NULL)

748 {

752 (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),

753 errmsg("role \"%s\" does not exist", rolename)));

754 }

755 else

756 {

760 (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),

761 errmsg("role with OID %u does not exist", roleid)));

762 }

763

765 roleid = rform->oid;

766 rname = NameStr(rform->rolname);

768

770

771

772

773

774

775

776

777

778

779

780

781

782

783

784

785

786

787

788

789

792

793

794

795

796

797

799 {

800

801

802

803

804 if (!bypass_login_check && !rform->rolcanlogin)

806 (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),

807 errmsg("role \"%s\" is not permitted to log in",

808 rname)));

809

810

811

812

813

814

815

816

817

818

819

820

821

822 if (rform->rolconnlimit >= 0 &&

827 (errcode(ERRCODE_TOO_MANY_CONNECTIONS),

828 errmsg("too many connections for role \"%s\"",

829 rname)));

830 }

831

833}

bool InitializingParallelWorker

void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source)

void AcceptInvalidationMessages(void)

#define IsBootstrapProcessingMode()

#define AmRegularBackendProcess()

void SetAuthenticatedUserId(Oid userid)

static bool is_superuser(Archive *fout)

static Datum PointerGetDatum(const void *X)

int CountUserBackends(Oid roleid)

References AcceptInvalidationMessages(), AmRegularBackendProcess, Assert(), CountUserBackends(), ereport, errcode(), errmsg(), FATAL, GETSTRUCT(), HeapTupleIsValid, InitializingParallelWorker, is_superuser(), IsBootstrapProcessingMode, IsUnderPostmaster, NameStr, ObjectIdGetDatum(), PGC_BACKEND, PGC_S_OVERRIDE, PointerGetDatum(), ReleaseSysCache(), SearchSysCache1(), SetAuthenticatedUserId(), and SetConfigOption().

Referenced by InitPostgres().

InitializeSessionUserIdStandalone()

void InitializeSessionUserIdStandalone ( void )

Definition at line 840 of file miscinit.c.

841{

842

843

844

845

848

849

851

853

854

855

856

857

858

859

860

861

863

864

866}

#define AmAutoVacuumWorkerProcess()

#define AmBackgroundWorkerProcess()

#define AmLogicalSlotSyncWorkerProcess()

void SetSessionAuthorization(Oid userid, bool is_superuser)

void SetCurrentRoleId(Oid roleid, bool is_superuser)

References AmAutoVacuumWorkerProcess, AmBackgroundWorkerProcess, AmLogicalSlotSyncWorkerProcess, Assert(), AuthenticatedUserId, InvalidOid, IsUnderPostmaster, OidIsValid, SetCurrentRoleId(), and SetSessionAuthorization().

Referenced by InitPostgres().

InitializeSystemUser()

void InitializeSystemUser ( const char * authn_id,
const char * auth_method
)

Definition at line 874 of file miscinit.c.

875{

877

878

880

881

882

883

884

886

888

889

892}

char * MemoryContextStrdup(MemoryContext context, const char *string)

void pfree(void *pointer)

MemoryContext TopMemoryContext

Datum system_user(PG_FUNCTION_ARGS)

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

References Assert(), authn_id, MemoryContextStrdup(), pfree(), psprintf(), system_user(), SystemUser, and TopMemoryContext.

Referenced by InitPostgres(), and ParallelWorkerMain().

InitPostgres()

void InitPostgres ( const char * in_dbname,
Oid dboid,
const char * username,
Oid useroid,
bits32 flags,
char * out_dbname
)

Definition at line 707 of file postinit.c.

711{

713 bool am_superuser;

714 char *fullpath;

716 int nfree = 0;

717

719

720

721

722

723

724

726

727

729

730

731

732

733

734

735 if (!bootstrap)

736 {

739 }

740

741

742

743

744

746

748

749

750

751

752

753 if (!bootstrap)

754 {

765 }

766

767

768

769

770

771

772

774 {

775

776

777

778

779

781

783

785

787

788

789

790

791

794 }

795

796

797

798

799

800

801

805

806

808

809

810

811

812

814

815

816

817

818

819

820

821

822

823

825

826

828 {

829

831

832 return;

833 }

834

835

836

837

838 if (!bootstrap)

839 {

840

843

844

845

846

847

848

849

851 }

852

853

854

855

856

857

858

859

860

862 {

864 am_superuser = true;

865 }

867 {

869 am_superuser = true;

872 (errcode(ERRCODE_UNDEFINED_OBJECT),

873 errmsg("no roles are defined in this database system"),

874 errhint("You should immediately run CREATE USER \"%s\" SUPERUSER;.",

876 }

878 {

880 {

882 am_superuser = true;

883 }

884 else

885 {

889 }

890 }

891 else

892 {

893

897

902 }

903

904

906 {

908

910 }

911

912

913

914

916 {

918 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),

919 errmsg("must be superuser to connect in binary upgrade mode")));

920 }

921

922

923

924

925

926

927

928

929

930

931

935 {

938 (errcode(ERRCODE_TOO_MANY_CONNECTIONS),

939 errmsg("remaining connection slots are reserved for roles with the %s attribute",

940 "SUPERUSER")));

941

944 (errcode(ERRCODE_TOO_MANY_CONNECTIONS),

945 errmsg("remaining connection slots are reserved for roles with privileges of the \"%s\" role",

946 "pg_use_reserved_connections")));

947 }

948

949

951 {

953

956 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),

957 errmsg("permission denied to start WAL sender"),

958 errdetail("Only roles with the %s attribute may start a WAL sender process.",

959 "REPLICATION")));

960 }

961

962

963

964

965

966

967

969 {

970

973

974

977

978

980

981

983

984

986

987 return;

988 }

989

990

991

992

993

994

995

996

997 if (bootstrap)

998 {

999 dboid = Template1DbOid;

1001 }

1002 else if (in_dbname != NULL)

1003 {

1006

1010 (errcode(ERRCODE_UNDEFINED_DATABASE),

1011 errmsg("database \"%s\" does not exist", in_dbname)));

1013 dboid = dbform->oid;

1014 }

1016 {

1017

1018

1019

1020

1021

1022

1023 if (!bootstrap)

1024 {

1027 }

1028 return;

1029 }

1030

1031

1032

1033

1034

1035

1036

1037

1038

1039

1040

1041

1042

1043

1044

1045

1046

1047

1048

1049

1050

1051

1052 if (!bootstrap)

1054

1055

1056

1057

1058

1059

1060 if (!bootstrap)

1061 {

1064

1068

1070 (in_dbname && namestrcmp(&datform->datname, in_dbname)))

1071 {

1072 if (in_dbname)

1074 (errcode(ERRCODE_UNDEFINED_DATABASE),

1075 errmsg("database \"%s\" does not exist", in_dbname),

1076 errdetail("It seems to have just been dropped or renamed.")));

1077 else

1079 (errcode(ERRCODE_UNDEFINED_DATABASE),

1080 errmsg("database %u does not exist", dboid)));

1081 }

1082

1084

1086 {

1088 errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),

1089 errmsg("cannot connect to invalid database \"%s\"", dbname),

1090 errhint("Use DROP DATABASE to drop invalid databases."));

1091 }

1092

1095

1096 if (out_dbname)

1097 strcpy(out_dbname, dbname);

1098 }

1099

1100

1101

1102

1103

1104

1105

1106

1107

1108

1109

1110

1112

1113

1114

1115

1116

1117

1118

1119

1120

1121

1122

1123

1124

1126

1127

1128

1129

1130

1131

1132

1134

1135

1136

1137

1138

1140

1141 if (!bootstrap)

1142 {

1143 if (access(fullpath, F_OK) == -1)

1144 {

1145 if (errno == ENOENT)

1147 (errcode(ERRCODE_UNDEFINED_DATABASE),

1148 errmsg("database \"%s\" does not exist",

1150 errdetail("The database subdirectory \"%s\" is missing.",

1151 fullpath)));

1152 else

1155 errmsg("could not access directory \"%s\": %m",

1156 fullpath)));

1157 }

1158

1160 }

1161

1163 pfree(fullpath);

1164

1165

1166

1167

1168

1169

1170

1172

1173

1175

1176

1177

1178

1179

1180

1181

1182 if (!bootstrap)

1185

1186

1187

1188

1189

1190

1193

1194

1196

1197

1200

1201

1202

1203

1204

1205

1206

1208

1209

1211

1212

1214

1215

1216

1217

1218

1219

1220

1221

1224

1225

1226 if (!bootstrap)

1228

1229

1230 if (!bootstrap)

1232}

void initialize_acl(void)

bool has_privs_of_role(Oid member, Oid role)

void pgstat_bestart_security(void)

void pgstat_bestart_initial(void)

void pgstat_bestart_final(void)

bool database_is_invalid_form(Form_pg_database datform)

bool MyDatabaseHasLoginEventTriggers

uint8 MyCancelKey[MAX_CANCEL_KEY_LENGTH]

const char * hba_authname(UserAuth auth_method)

#define INJECTION_POINT(name, arg)

void before_shmem_exit(pg_on_exit_callback function, Datum arg)

void LockSharedObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode)

void InitializeClientEncoding(void)

#define INIT_PG_LOAD_SESSION_LIBS

#define INIT_PG_OVERRIDE_ROLE_LOGIN

#define INIT_PG_OVERRIDE_ALLOW_CONNS

void InitializeSessionUserId(const char *rolename, Oid roleid, bool bypass_login_check)

void InitializeSystemUser(const char *authn_id, const char *auth_method)

void InitializeSessionUserIdStandalone(void)

void process_session_preload_libraries(void)

Oid GetSessionUserId(void)

void SetDatabasePath(const char *path)

bool has_rolreplication(Oid roleid)

int namestrcmp(Name name, const char *str)

void InitializeSearchPath(void)

FormData_pg_database * Form_pg_database

void pgstat_before_server_shutdown(int code, Datum arg)

size_t strlcpy(char *dst, const char *src, size_t siz)

void EnablePortalManager(void)

static void ShutdownPostgres(int code, Datum arg)

static void IdleInTransactionSessionTimeoutHandler(void)

static void LockTimeoutHandler(void)

static void IdleStatsUpdateTimeoutHandler(void)

static void process_settings(Oid databaseid, Oid roleid)

static void IdleSessionTimeoutHandler(void)

static void process_startup_options(Port *port, bool am_superuser)

static void StatementTimeoutHandler(void)

static void CheckMyDatabase(const char *name, bool am_superuser, bool override_allow_connections)

static bool ThereIsAtLeastOneRole(void)

static void PerformAuthentication(Port *port)

static void ClientCheckTimeoutHandler(void)

static HeapTuple GetDatabaseTuple(const char *dbname)

static HeapTuple GetDatabaseTupleByOid(Oid dboid)

static void TransactionTimeoutHandler(void)

int SuperuserReservedConnections

void ProcSignalInit(const uint8 *cancel_key, int cancel_key_len)

void RelationCacheInitializePhase3(void)

void RelationCacheInitialize(void)

void RelationCacheInitializePhase2(void)

char * GetDatabasePath(Oid dbOid, Oid spcOid)

void ReleaseAuxProcessResources(bool isCommit)

ResourceOwner CurrentResourceOwner

void CreateAuxProcessResourceOwner(void)

void InitializeSession(void)

void pg_usleep(long microsec)

void SharedInvalBackendInit(bool sendOnly)

void InvalidateCatalogSnapshot(void)

bool HaveNFreeProcs(int n, int *nfree)

void CheckDeadLockAlert(void)

void InitProcessPhase2(void)

void InitCatalogCache(void)

TimeoutId RegisterTimeout(TimeoutId id, timeout_handler_proc handler)

@ IDLE_IN_TRANSACTION_SESSION_TIMEOUT

@ IDLE_STATS_UPDATE_TIMEOUT

@ CLIENT_CONNECTION_CHECK_TIMEOUT

void StartTransactionCommand(void)

void SetCurrentStatementStartTimestamp(void)

void CommitTransactionCommand(void)

#define XACT_READ_COMMITTED

void ShutdownXLOG(int code, Datum arg)

References am_db_walsender, am_walsender, AmAutoVacuumLauncherProcess, AmAutoVacuumWorkerProcess, AmBackgroundWorkerProcess, AmLogicalSlotSyncWorkerProcess, AmRegularBackendProcess, Assert(), ClientConnectionInfo::auth_method, ClientConnectionInfo::authn_id, before_shmem_exit(), CheckDeadLockAlert(), CheckMyDatabase(), CLIENT_CONNECTION_CHECK_TIMEOUT, ClientCheckTimeoutHandler(), CommitTransactionCommand(), CreateAuxProcessResourceOwner(), CurrentResourceOwner, database_is_invalid_form(), PGPROC::databaseId, dbname, DEADLOCK_TIMEOUT, DEBUG3, elog, EnablePortalManager(), ereport, errcode(), errcode_for_file_access(), errdetail(), errhint(), errmsg(), FATAL, GetDatabasePath(), GetDatabaseTuple(), GetDatabaseTupleByOid(), GetSessionUserId(), GETSTRUCT(), GetUserId(), has_privs_of_role(), has_rolreplication(), HaveNFreeProcs(), hba_authname(), HeapTupleIsValid, IDLE_IN_TRANSACTION_SESSION_TIMEOUT, IDLE_SESSION_TIMEOUT, IDLE_STATS_UPDATE_TIMEOUT, IdleInTransactionSessionTimeoutHandler(), IdleSessionTimeoutHandler(), IdleStatsUpdateTimeoutHandler(), INIT_PG_LOAD_SESSION_LIBS, INIT_PG_OVERRIDE_ALLOW_CONNS, INIT_PG_OVERRIDE_ROLE_LOGIN, InitCatalogCache(), initialize_acl(), InitializeClientEncoding(), InitializeSearchPath(), InitializeSession(), InitializeSessionUserId(), InitializeSessionUserIdStandalone(), InitializeSystemUser(), InitPlanCache(), InitProcessPhase2(), INJECTION_POINT, InvalidateCatalogSnapshot(), IsBinaryUpgrade, IsBootstrapProcessingMode, IsUnderPostmaster, LOCK_TIMEOUT, LockSharedObject(), LockTimeoutHandler(), MyCancelKey, MyCancelKeyLength, MyClientConnectionInfo, MyDatabaseHasLoginEventTriggers, MyDatabaseId, MyDatabaseTableSpace, MyProc, MyProcPort, NAMEDATALEN, NameStr, namestrcmp(), OidIsValid, PerformAuthentication(), pfree(), pg_usleep(), pgstat_before_server_shutdown(), pgstat_beinit(), pgstat_bestart_final(), pgstat_bestart_initial(), pgstat_bestart_security(), PostAuthDelay, process_session_preload_libraries(), process_settings(), process_startup_options(), ProcSignalInit(), RegisterTimeout(), RelationCacheInitialize(), RelationCacheInitializePhase2(), RelationCacheInitializePhase3(), ReleaseAuxProcessResources(), ReservedConnections, RowExclusiveLock, SetCurrentStatementStartTimestamp(), SetDatabasePath(), SharedInvalBackendInit(), ShutdownPostgres(), ShutdownXLOG(), StartTransactionCommand(), StartupXLOG(), STATEMENT_TIMEOUT, StatementTimeoutHandler(), strlcpy(), superuser(), SuperuserReservedConnections, ThereIsAtLeastOneRole(), TRANSACTION_TIMEOUT, TransactionTimeoutHandler(), username, ValidatePgVersion(), WARNING, XACT_READ_COMMITTED, and XactIsoLevel.

Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), BackgroundWorkerInitializeConnection(), BackgroundWorkerInitializeConnectionByOid(), BootstrapModeMain(), PostgresMain(), and ReplSlotSyncWorkerMain().

InitPostmasterChild()

void InitPostmasterChild ( void )

Definition at line 96 of file miscinit.c.

97{

98 IsUnderPostmaster = true;

99

100

101

102

103

104

105#ifdef WIN32

107#endif

108

110

111

112

113

114

115

116

117#ifdef WIN32

118 _setmode(fileno(stderr), _O_BINARY);

119#endif

120

121

123

124

125#ifdef EXEC_BACKEND

127#endif

128

129

133

134

135

136

137

138

139

140#ifdef HAVE_SETSID

141 if (setsid() < 0)

142 elog(FATAL, "setsid() failed: %m");

143#endif

144

145

146

147

148

149

150

151

153

155 sigprocmask(SIG_SETMASK, &BlockSig, NULL);

156

157

159

160

161#ifndef WIN32

165 errmsg_internal("could not set postmaster death monitoring pipe to FD_CLOEXEC mode: %m")));

166#endif

167}

int errcode_for_socket_access(void)

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

void SignalHandlerForCrashExit(SIGNAL_ARGS)

void InitializeLatchWaitSet(void)

void InitProcessLocalLatch(void)

void PostmasterDeathSignalInit(void)

void InitProcessGlobals(void)

int postmaster_alive_fds[2]

#define POSTMASTER_FD_WATCH

void pgwin32_signal_initialize(void)

void InitializeWaitEventSupport(void)

References BlockSig, elog, ereport, errcode_for_socket_access(), errmsg_internal(), FATAL, InitializeLatchWaitSet(), InitializeWaitEventSupport(), InitProcessGlobals(), InitProcessLocalLatch(), IsUnderPostmaster, on_exit_reset(), pgwin32_signal_initialize(), postmaster_alive_fds, POSTMASTER_FD_WATCH, PostmasterDeathSignalInit(), pqinitmask(), pqsignal, SignalHandlerForCrashExit(), and SIGQUIT.

Referenced by postmaster_child_launch().

InitProcessLocalLatch()

void InitProcessLocalLatch ( void )

InitStandaloneProcess()

void InitStandaloneProcess ( const char * argv0 )

Definition at line 175 of file miscinit.c.

176{

178

180

181

182

183

184#ifdef WIN32

186#endif

187

189

190

194

195

196

197

198

200 sigprocmask(SIG_SETMASK, &BlockSig, NULL);

201

202

204 {

206 elog(FATAL, "%s: could not locate my own executable path",

208 }

209

212}

int find_my_exec(const char *argv0, char *retpath)

char pkglib_path[MAXPGPATH]

bool IsPostmasterEnvironment

char my_exec_path[MAXPGPATH]

BackendType MyBackendType

void get_pkglib_path(const char *my_exec_path, char *ret_path)

References argv0, Assert(), B_STANDALONE_BACKEND, BlockSig, elog, FATAL, find_my_exec(), get_pkglib_path(), InitializeLatchWaitSet(), InitializeWaitEventSupport(), InitProcessGlobals(), InitProcessLocalLatch(), IsPostmasterEnvironment, my_exec_path, MyBackendType, pgwin32_signal_initialize(), pkglib_path, and pqinitmask().

Referenced by BootstrapModeMain(), and PostgresSingleUserMain().

InLocalUserIdChange()

bool InLocalUserIdChange ( void )

InNoForceRLSOperation()

bool InNoForceRLSOperation ( void )

InSecurityRestrictedOperation()

bool InSecurityRestrictedOperation ( void )

pg_bindtextdomain()

void pg_bindtextdomain ( const char * domain )

pg_split_opts()

void pg_split_opts ( char ** argv,
int * argcp,
const char * optstr
)

Definition at line 492 of file postinit.c.

493{

495

497

498 while (*optstr)

499 {

500 bool last_was_escape = false;

501

503

504

505 while (isspace((unsigned char) *optstr))

506 optstr++;

507

508 if (*optstr == '\0')

509 break;

510

511

512

513

514

515 while (*optstr)

516 {

517 if (isspace((unsigned char) *optstr) && !last_was_escape)

518 break;

519

520 if (!last_was_escape && *optstr == '\\')

521 last_was_escape = true;

522 else

523 {

524 last_was_escape = false;

526 }

527

528 optstr++;

529 }

530

531

533 }

534

536}

void resetStringInfo(StringInfo str)

void appendStringInfoChar(StringInfo str, char ch)

void initStringInfo(StringInfo str)

References appendStringInfoChar(), StringInfoData::data, initStringInfo(), pfree(), pstrdup(), and resetStringInfo().

Referenced by process_startup_options().

PreventCommandDuringRecovery()

void PreventCommandDuringRecovery ( const char * cmdname )

PreventCommandIfParallelMode()

void PreventCommandIfParallelMode ( const char * cmdname )

PreventCommandIfReadOnly()

void PreventCommandIfReadOnly ( const char * cmdname )

Definition at line 406 of file utility.c.

407{

410 (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),

411

412 errmsg("cannot execute %s in a read-only transaction",

413 cmdname)));

414}

References ereport, errcode(), errmsg(), ERROR, and XactReadOnly.

Referenced by be_lo_creat(), be_lo_create(), be_lo_from_bytea(), be_lo_open(), be_lo_put(), be_lo_truncate(), be_lo_truncate64(), be_lo_unlink(), be_lowrite(), DoCopy(), ExecCheckXactReadOnly(), lo_import_internal(), nextval_internal(), SetSequence(), and standard_ProcessUtility().

process_session_preload_libraries()

void process_session_preload_libraries ( void )

process_shared_preload_libraries()

void process_shared_preload_libraries ( void )

process_shmem_requests()

void process_shmem_requests ( void )

ProcessInterrupts()

void ProcessInterrupts ( void )

Definition at line 3304 of file postgres.c.

3305{

3306

3308 return;

3310

3312 {

3316

3321 (errcode(ERRCODE_QUERY_CANCELED),

3322 errmsg("canceling authentication due to timeout")));

3325 (errcode(ERRCODE_ADMIN_SHUTDOWN),

3326 errmsg("terminating autovacuum process due to administrator command")));

3329 (errcode(ERRCODE_ADMIN_SHUTDOWN),

3330 errmsg("terminating logical replication worker due to administrator command")));

3332 {

3334 (errmsg_internal("logical replication launcher shutting down")));

3335

3336

3337

3338

3339

3341 }

3344 (errcode(ERRCODE_ADMIN_SHUTDOWN),

3345 errmsg("terminating walreceiver process due to administrator command")));

3348 (errcode(ERRCODE_ADMIN_SHUTDOWN),

3349 errmsg("terminating background worker \"%s\" due to administrator command",

3352 {

3354 (errmsg_internal("io worker shutting down due to administrator command")));

3355

3357 }

3358 else

3360 (errcode(ERRCODE_ADMIN_SHUTDOWN),

3361 errmsg("terminating connection due to administrator command")));

3362 }

3363

3365 {

3367

3368

3369

3370

3371

3372

3373

3375 {

3378 else

3381 }

3382 }

3383

3385 {

3386 QueryCancelPending = false;

3388

3391 (errcode(ERRCODE_CONNECTION_FAILURE),

3392 errmsg("connection to client lost")));

3393 }

3394

3395

3396

3397

3398

3399

3400

3401

3402

3404 {

3405

3406

3407

3408

3409

3410

3411

3412

3414 }

3416 {

3417 bool lock_timeout_occurred;

3418 bool stmt_timeout_occurred;

3419

3421

3422

3423

3424

3425

3428

3429

3430

3431

3432

3433

3434

3435 if (lock_timeout_occurred && stmt_timeout_occurred &&

3437 lock_timeout_occurred = false;

3438

3439 if (lock_timeout_occurred)

3440 {

3443 (errcode(ERRCODE_LOCK_NOT_AVAILABLE),

3444 errmsg("canceling statement due to lock timeout")));

3445 }

3446 if (stmt_timeout_occurred)

3447 {

3450 (errcode(ERRCODE_QUERY_CANCELED),

3451 errmsg("canceling statement due to statement timeout")));

3452 }

3454 {

3457 (errcode(ERRCODE_QUERY_CANCELED),

3458 errmsg("canceling autovacuum task")));

3459 }

3460

3461

3462

3463

3464

3465

3467 {

3470 (errcode(ERRCODE_QUERY_CANCELED),

3471 errmsg("canceling statement due to user request")));

3472 }

3473 }

3474

3477

3479 {

3480

3481

3482

3483

3484

3485

3488 {

3489 INJECTION_POINT("idle-in-transaction-session-timeout", NULL);

3491 (errcode(ERRCODE_IDLE_IN_TRANSACTION_SESSION_TIMEOUT),

3492 errmsg("terminating connection due to idle-in-transaction timeout")));

3493 }

3494 }

3495

3497 {

3498

3501 {

3504 (errcode(ERRCODE_TRANSACTION_TIMEOUT),

3505 errmsg("terminating connection due to transaction timeout")));

3506 }

3507 }

3508

3510 {

3511

3514 {

3517 (errcode(ERRCODE_IDLE_SESSION_TIMEOUT),

3518 errmsg("terminating connection due to idle-session timeout")));

3519 }

3520 }

3521

3522

3523

3524

3525

3528 {

3531 }

3532

3535

3538

3541

3544}

volatile sig_atomic_t ParallelApplyMessagePending

void ProcessParallelApplyMessages(void)

void ProcessParallelMessages(void)

volatile sig_atomic_t ParallelMessagePending

bool IsLogicalWorker(void)

volatile sig_atomic_t IdleStatsUpdateTimeoutPending

volatile sig_atomic_t LogMemoryContextPending

volatile sig_atomic_t ProcSignalBarrierPending

volatile sig_atomic_t InterruptPending

volatile sig_atomic_t IdleSessionTimeoutPending

volatile uint32 QueryCancelHoldoffCount

volatile sig_atomic_t IdleInTransactionSessionTimeoutPending

volatile uint32 InterruptHoldoffCount

volatile sig_atomic_t TransactionTimeoutPending

volatile sig_atomic_t ClientConnectionLost

volatile uint32 CritSectionCount

volatile sig_atomic_t QueryCancelPending

volatile sig_atomic_t ProcDiePending

volatile sig_atomic_t CheckClientConnectionPending

bool IsLogicalLauncher(void)

void ProcessLogMemoryContextInterrupt(void)

#define AmWalReceiverProcess()

#define AmIoWorkerProcess()

long pgstat_report_stat(bool force)

int client_connection_check_interval

CommandDest whereToSendOutput

static volatile sig_atomic_t RecoveryConflictPending

static bool DoingCommandRead

static void ProcessRecoveryConflictInterrupts(void)

bool ClientAuthInProgress

BackgroundWorker * MyBgworkerEntry

bool pq_check_connection(void)

void ProcessProcSignalBarrier(void)

int IdleInTransactionSessionTimeout

void LockErrorCleanup(void)

char bgw_type[BGW_MAXLEN]

void enable_timeout_after(TimeoutId id, int delay_ms)

TimestampTz get_timeout_finish_time(TimeoutId id)

bool get_timeout_indicator(TimeoutId id, bool reset_indicator)

bool IsTransactionOrTransactionBlock(void)

References AmAutoVacuumWorkerProcess, AmBackgroundWorkerProcess, AmIoWorkerProcess, AmWalReceiverProcess, BackgroundWorker::bgw_type, CheckClientConnectionPending, client_connection_check_interval, CLIENT_CONNECTION_CHECK_TIMEOUT, ClientAuthInProgress, ClientConnectionLost, CritSectionCount, DEBUG1, DestNone, DestRemote, DoingCommandRead, enable_timeout_after(), ereport, errcode(), errmsg(), errmsg_internal(), ERROR, FATAL, get_timeout_finish_time(), get_timeout_indicator(), IdleInTransactionSessionTimeout, IdleInTransactionSessionTimeoutPending, IdleSessionTimeout, IdleSessionTimeoutPending, IdleStatsUpdateTimeoutPending, INJECTION_POINT, InterruptHoldoffCount, InterruptPending, IsLogicalLauncher(), IsLogicalWorker(), IsTransactionOrTransactionBlock(), LOCK_TIMEOUT, LockErrorCleanup(), LogMemoryContextPending, MyBgworkerEntry, ParallelApplyMessagePending, ParallelMessagePending, pgstat_report_stat(), pq_check_connection(), proc_exit(), ProcDiePending, ProcessLogMemoryContextInterrupt(), ProcessParallelApplyMessages(), ProcessParallelMessages(), ProcessProcSignalBarrier(), ProcessRecoveryConflictInterrupts(), ProcSignalBarrierPending, QueryCancelHoldoffCount, QueryCancelPending, RecoveryConflictPending, STATEMENT_TIMEOUT, TransactionTimeout, TransactionTimeoutPending, and whereToSendOutput.

Referenced by die().

RecheckDataDirLockFile()

bool RecheckDataDirLockFile ( void )

Definition at line 1646 of file miscinit.c.

1647{

1648 int fd;

1649 int len;

1650 long file_pid;

1651 char buffer[BLCKSZ];

1652

1654 if (fd < 0)

1655 {

1656

1657

1658

1659

1660

1661 switch (errno)

1662 {

1663 case ENOENT:

1664 case ENOTDIR:

1665

1668 errmsg("could not open file \"%s\": %m",

1670 return false;

1671 default:

1672

1675 errmsg("could not open file \"%s\": %m; continuing anyway",

1677 return true;

1678 }

1679 }

1681 len = read(fd, buffer, sizeof(buffer) - 1);

1683 if (len < 0)

1684 {

1687 errmsg("could not read from file \"%s\": %m",

1690 return true;

1691 }

1692 buffer[len] = '\0';

1694 file_pid = atol(buffer);

1695 if (file_pid == getpid())

1696 return true;

1697

1698

1700 (errmsg("lock file \"%s\" contains wrong PID: %ld instead of %ld",

1702 return false;

1703}

References close, DIRECTORY_LOCK_FILE, ereport, errcode_for_file_access(), errmsg(), fd(), len, LOG, PG_BINARY, pgstat_report_wait_end(), pgstat_report_wait_start(), and read.

Referenced by ServerLoop().

restore_stack_base()

RestoreClientConnectionInfo()

void RestoreClientConnectionInfo ( char * conninfo )

SerializeClientConnectionInfo()

void SerializeClientConnectionInfo ( Size maxsize,
char * start_address
)

set_stack_base()

Definition at line 44 of file stack_depth.c.

45{

46#ifndef HAVE__BUILTIN_FRAME_ADDRESS

47 char stack_base;

48#endif

50

52

53

54

55

56

57

58#ifdef HAVE__BUILTIN_FRAME_ADDRESS

60#else

62#endif

63

64 return old;

65}

References stack_base_ptr.

Referenced by main().

SetAuthenticatedUserId()

void SetAuthenticatedUserId ( Oid userid )

SetCurrentRoleId()

void SetCurrentRoleId ( Oid roleid,
bool is_superuser
)

SetDatabasePath()

void SetDatabasePath ( const char * path )

SetDataDir()

void SetDataDir ( const char * dir )

SetSessionAuthorization()

void SetSessionAuthorization ( Oid userid,
bool is_superuser
)

SetUserIdAndContext()

void SetUserIdAndContext ( Oid userid,
bool sec_def_context
)

SetUserIdAndSecContext()

void SetUserIdAndSecContext ( Oid userid,
int sec_context
)

Definition at line 619 of file miscinit.c.

References CurrentUserId, and SecurityRestrictionContext.

Referenced by AbortSubTransaction(), AbortTransaction(), AfterTriggerExecute(), amcheck_lock_relation_and_check(), ATExecMergePartitions(), ATExecSplitPartition(), brin_summarize_range(), cluster_rel(), ComputeIndexAttrs(), CreateSchemaCommand(), DefineIndex(), do_analyze_rel(), execute_extension_script(), fmgr_security_definer(), index_build(), index_concurrently_build(), ParallelWorkerMain(), refresh_by_match_merge(), RefreshMatViewByOid(), reindex_index(), ReindexRelationConcurrently(), RestoreUserContext(), ri_PerformCheck(), ri_PlanCheck(), SwitchToUntrustedUser(), vacuum_rel(), and validate_index().

stack_is_too_deep()

bool stack_is_too_deep ( void )

superuser()

Definition at line 46 of file superuser.c.

References GetUserId(), and superuser_arg().

Referenced by AlterForeignDataWrapper(), AlterForeignDataWrapperOwner_internal(), AlterForeignServerOwner_internal(), AlterFunction(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterOpFamily(), AlterPublicationOwner_internal(), AlterRole(), AlterRoleSet(), AlterSubscription(), AlterSubscriptionOwner_internal(), AlterSystemSetConfigFile(), AlterType(), AlterTypeOwner(), ATExecChangeOwner(), brin_metapage_info(), brin_page_items(), brin_page_type(), brin_revmap_data(), bt_metap(), bt_multi_page_stats(), bt_page_items_bytea(), bt_page_items_internal(), bt_page_stats_internal(), check_encoding_locale_matches(), CheckAlterPublication(), CreateAccessMethod(), CreateCast(), CreateEventTrigger(), CreateForeignDataWrapper(), CreateFunction(), CreateProceduralLanguage(), CreatePublication(), CreateRole(), CreateSubscription(), CreateTableSpace(), dblink_connstr_check(), dblink_security_check(), DefineAggregate(), DefineOpClass(), DefineOpFamily(), DefineTSParser(), DefineTSTemplate(), DefineType(), DropRole(), dummy_object_relabel(), EnableDisableTrigger(), ExecSetVariableStmt(), execute_extension_script(), ExecuteDoStmt(), fmgr_security_definer(), fsm_page_contents(), get_raw_page_internal(), gin_leafpage_items(), gin_metapage_info(), gin_page_opaque_info(), gist_page_items(), gist_page_items_bytea(), gist_page_opaque_info(), GUCArrayReset(), hash_bitmap_info(), hash_metapage_info(), hash_page_items(), hash_page_stats(), hash_page_type(), have_createdb_privilege(), heap_page_items(), heap_tuple_infomask_flags(), InitPostgres(), interpret_func_support(), main(), page_checksum_internal(), page_header(), pg_buffercache_superuser_check(), pg_import_system_collations(), pg_nextoid(), pg_relpages(), pg_relpagesbyid(), pg_signal_backend(), pg_stop_making_pinned_objects(), pgstat_get_backend_current_activity(), pgstatginindex(), pgstatindex(), pgstatindexbyid(), pgstattuple(), pgstattuple_approx(), pgstattuplebyid(), postgres_fdw_validator(), ProcedureCreate(), regress_setenv(), RenameRole(), sepgsql_restorecon(), set_config_by_name(), SetPGVariable(), standard_ProcessUtility(), TerminateOtherDBBackends(), tuple_data_split(), validate_option_array_item(), and wait_pid().

superuser_arg()

bool superuser_arg ( Oid roleid )

Definition at line 56 of file superuser.c.

57{

58 bool result;

60

61

64

65

67 return true;

68

69

72 {

75 }

76 else

77 {

78

79 result = false;

80 }

81

82

84 {

89 }

90

91

94

95 return result;

96}

void CacheRegisterSyscacheCallback(int cacheid, SyscacheCallbackFunction func, Datum arg)

static bool roleid_callback_registered

static void RoleidCallback(Datum arg, int cacheid, uint32 hashvalue)

static bool last_roleid_is_super

References CacheRegisterSyscacheCallback(), GETSTRUCT(), HeapTupleIsValid, IsUnderPostmaster, last_roleid, last_roleid_is_super, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), roleid_callback_registered, RoleidCallback(), rolsuper, and SearchSysCache1().

Referenced by AlterEventTriggerOwner_internal(), AlterForeignDataWrapperOwner_internal(), AlterPublicationOwner_internal(), check_conn_params(), check_object_ownership(), check_role_grantor(), check_role_membership_authorization(), check_session_authorization(), CreateRole(), CreateSubscription(), DropSubscription(), emit_audit_message(), GetSubscription(), has_bypassrls_privilege(), has_createrole_privilege(), has_privs_of_role(), has_rolreplication(), is_admin_of_role(), is_member_of_role(), LockGXact(), member_can_set_role(), object_aclmask_ext(), object_ownercheck(), pg_class_aclmask_ext(), pg_largeobject_aclmask_snapshot(), pg_namespace_aclmask_ext(), pg_parameter_acl_aclmask(), pg_parameter_aclmask(), pg_signal_backend(), pg_type_aclmask_ext(), pgfdw_security_check(), REGRESS_exec_check_perms(), REGRESS_object_access_hook(), REGRESS_object_access_hook_str(), REGRESS_utility_command(), select_best_grantor(), superuser(), and TerminateOtherDBBackends().

SwitchBackToLocalLatch()

void SwitchBackToLocalLatch ( void )

Definition at line 242 of file miscinit.c.

243{

246

248

252

254}

void SetLatch(Latch *latch)

#define FeBeWaitSetLatchPos

WaitEventSet * FeBeWaitSet

void ModifyWaitEvent(WaitEventSet *set, int pos, uint32 events, Latch *latch)

References Assert(), FeBeWaitSet, FeBeWaitSetLatchPos, LocalLatchData, ModifyWaitEvent(), MyLatch, MyProc, PGPROC::procLatch, SetLatch(), and WL_LATCH_SET.

Referenced by AuxiliaryProcKill(), and ProcKill().

SwitchToSharedLatch()

void SwitchToSharedLatch ( void )

Definition at line 215 of file miscinit.c.

216{

219

221

225

226

227

228

229

230

232}

References Assert(), FeBeWaitSet, FeBeWaitSetLatchPos, LocalLatchData, ModifyWaitEvent(), MyLatch, MyProc, PGPROC::procLatch, SetLatch(), and WL_LATCH_SET.

Referenced by InitAuxiliaryProcess(), and InitProcess().

TouchSocketLockFiles()

void TouchSocketLockFiles ( void )

ValidatePgVersion()

void ValidatePgVersion ( const char * path )

Definition at line 1718 of file miscinit.c.

1719{

1721 FILE *file;

1722 int ret;

1723 long file_major;

1724 long my_major;

1725 char *endptr;

1726 char file_version_string[64];

1727 const char *my_version_string = PG_VERSION;

1728

1729 my_major = strtol(my_version_string, &endptr, 10);

1730

1731 snprintf(full_path, sizeof(full_path), "%s/PG_VERSION", path);

1732

1734 if (!file)

1735 {

1736 if (errno == ENOENT)

1738 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),

1739 errmsg("\"%s\" is not a valid data directory",

1740 path),

1741 errdetail("File \"%s\" is missing.", full_path)));

1742 else

1745 errmsg("could not open file \"%s\": %m", full_path)));

1746 }

1747

1748 file_version_string[0] = '\0';

1749 ret = fscanf(file, "%63s", file_version_string);

1750 file_major = strtol(file_version_string, &endptr, 10);

1751

1752 if (ret != 1 || endptr == file_version_string)

1754 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),

1755 errmsg("\"%s\" is not a valid data directory",

1756 path),

1757 errdetail("File \"%s\" does not contain valid data.",

1758 full_path),

1759 errhint("You might need to initdb.")));

1760

1762

1763 if (my_major != file_major)

1765 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),

1766 errmsg("database files are incompatible with server"),

1767 errdetail("The data directory was initialized by PostgreSQL version %s, "

1768 "which is not compatible with this version %s.",

1769 file_version_string, my_version_string)));

1770}

FILE * AllocateFile(const char *name, const char *mode)

References AllocateFile(), ereport, errcode(), errcode_for_file_access(), errdetail(), errhint(), errmsg(), FATAL, FreeFile(), MAXPGPATH, and snprintf.

Referenced by checkDataDir(), and InitPostgres().

allowSystemTableMods

Definition at line 130 of file globals.c.

Referenced by ATAddForeignKeyConstraint(), ATExecAddIndexConstraint(), ATSimplePermissions(), createdb(), createPartitionTable(), CreateSchemaCommand(), CreateStatistics(), CreateTableSpace(), CreateTriggerFiringOn(), DefineIndex(), DefineQueryRewrite(), DefineRelation(), perform_relmap_update(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForDropRelation(), RangeVarCallbackForPolicy(), RangeVarCallbackForRenameRule(), RangeVarCallbackForRenameTrigger(), RangeVarCallbackOwnsRelation(), RemovePolicyById(), RemoveRewriteRuleById(), RemoveTriggerById(), renameatt_check(), RenameSchema(), RenameTableSpace(), and truncate_check_rel().

CheckClientConnectionPending

PGDLLIMPORT volatile sig_atomic_t CheckClientConnectionPending extern

ClientConnectionLost

commit_timestamp_buffers

CritSectionCount

Definition at line 45 of file globals.c.

Referenced by AtInplace_Inval(), CompactCheckpointerRequestQueue(), errfinish(), errstart(), heap_page_would_be_all_visible(), HeapTupleHeaderGetCmax(), log_newpage_buffer(), MemoryContextCreate(), pgaio_io_process_completion(), pgstat_prepare_report_checksum_failure(), PreInplace_Inval(), proc_exit_prepare(), ProcessClientWriteInterrupt(), ProcessInterrupts(), visibilitymap_set_vmbits(), XactLogAbortRecord(), XactLogCommitRecord(), XLogEnsureRecordSpace(), and XLogWrite().

data_directory_mode

DatabasePath

DataDir

Definition at line 71 of file globals.c.

Referenced by AbsoluteConfigLocation(), ChangeToDataDir(), checkControlFile(), checkDataDir(), convert_and_check_filename(), CreateDataDirLockFile(), CreateLockFile(), CreateTableSpace(), do_pg_backup_start(), get_controlfile(), GetSharedMemName(), InitWalRecovery(), main(), pg_control_checkpoint(), pg_control_init(), pg_control_recovery(), pg_control_system(), PGReserveSemaphores(), PGSharedMemoryAttach(), PGSharedMemoryCreate(), ProcessConfigFileInternal(), SelectConfigFiles(), SetDataDir(), update_controlfile(), and UpdateControlFile().

DateOrder

DateStyle

enableFsync

Definition at line 129 of file globals.c.

Referenced by copydir(), get_sync_bit(), issue_xlog_fsync(), pg_fdatasync(), pg_flush_data(), pg_fsync_no_writethrough(), pg_fsync_writethrough(), ProcessSyncRequests(), ScheduleBufferTagForWriteback(), SyncDataDirectory(), and XLogFlush().

ExitOnAnyError

hash_mem_multiplier

IdleInTransactionSessionTimeoutPending

PGDLLIMPORT volatile sig_atomic_t IdleInTransactionSessionTimeoutPending extern

IdleSessionTimeoutPending

PGDLLIMPORT volatile sig_atomic_t IdleSessionTimeoutPending extern

IdleStatsUpdateTimeoutPending

PGDLLIMPORT volatile sig_atomic_t IdleStatsUpdateTimeoutPending extern

IgnoreSystemIndexes

InterruptHoldoffCount

InterruptPending

Definition at line 32 of file globals.c.

Referenced by ClientCheckTimeoutHandler(), die(), HandleLogMemoryContextInterrupt(), HandleParallelApplyMessageInterrupt(), HandleParallelMessageInterrupt(), HandleProcSignalBarrierInterrupt(), HandleRecoveryConflictInterrupt(), IdleInTransactionSessionTimeoutHandler(), IdleSessionTimeoutHandler(), IdleStatsUpdateTimeoutHandler(), internal_flush_buffer(), proc_exit_prepare(), ProcessInterrupts(), ProcessRecoveryConflictInterrupt(), ResetProcSignalBarrierBits(), StatementCancelHandler(), TransactionTimeoutHandler(), and vacuum_delay_point().

IntervalStyle

IsBinaryUpgrade

Definition at line 121 of file globals.c.

Referenced by AddEnumLabel(), ApplyLauncherRegister(), AssignTypeArrayOid(), AssignTypeMultirangeArrayOid(), AssignTypeMultirangeOid(), create_toast_table(), CreateDatabaseUsingFileCopy(), createdb(), CreateRole(), CreateTableSpace(), DefineCollation(), GetNewOidWithIndex(), GetNewRelFileNumber(), heap_create_with_catalog(), icu_validate_locale(), index_create(), index_update_stats(), InitPostgres(), InvalidateObsoleteReplicationSlots(), KeepLogSeg(), LaunchMissingBackgroundProcesses(), mdunlinkfork(), PostmasterMain(), process_postgres_switches(), RelationSetNewRelfilenumber(), ReplicationSlotCreate(), truncate_check_rel(), TypeCreate(), and TypeShellMake().

IsPostmasterEnvironment

Definition at line 119 of file globals.c.

Referenced by dsm_create(), get_slru_entry(), GetNewObjectId(), HotStandbyActiveInReplay(), InitStandaloneProcess(), MarkAsPreparingGuts(), pgstat_fetch_entry(), pgstat_read_statsfile(), pgstat_shutdown_hook(), pgstat_wal_flush_cb(), postmaster_child_launch(), PostmasterMain(), RegisterBackgroundWorker(), RequestCheckpoint(), SetNextObjectId(), ShutdownXLOG(), StartupXLOG(), and UnlinkLockFiles().

IsUnderPostmaster

Definition at line 120 of file globals.c.

Referenced by _PG_init(), AdvanceNextFullTransactionIdPastXid(), AutoVacuumShmemInit(), AuxiliaryProcessMainCommon(), BackgroundWorkerShmemInit(), bootstrap_signals(), BootstrapModeMain(), BTreeShmemInit(), CheckMyDatabase(), CheckRecoveryConsistency(), CommitTsShmemInit(), createdb(), CreateLWLocks(), CreateOrAttachShmemStructs(), CreateRestartPoint(), CreateSharedMemoryAndSemaphores(), DebugFileOpen(), dsm_attach(), dsm_backend_startup(), dsm_create(), dsm_impl_pin_segment(), dsm_impl_posix_resize(), dsm_impl_unpin_segment(), dsm_postmaster_startup(), EventTriggerDDLCommandEnd(), EventTriggerDDLCommandStart(), EventTriggerOnLogin(), EventTriggerSQLDrop(), EventTriggerTableRewrite(), ForwardSyncRequest(), get_slru_entry(), GetNewMultiXactId(), GetNewTransactionId(), GetQuitSignalReason(), init_ps_display(), InitAuxiliaryProcess(), InitializeLatchWaitSet(), InitializeSessionUserId(), InitializeSessionUserIdStandalone(), InitializeWaitEventSupport(), InitPostgres(), InitPostmasterChild(), InitProcess(), InitSync(), InjectionPointShmemInit(), LWLockAcquire(), MaintainLatestCompletedXidRecovery(), MultiXactShmemInit(), parallel_vacuum_compute_workers(), PerformRecoveryXLogAction(), PerformWalRecovery(), pg_get_shmem_pagesize(), pgaio_io_wait(), pgaio_worker_needs_synchronous_execution(), PGSemaphoreCreate(), PGSharedMemoryNoReAttach(), PGSharedMemoryReAttach(), pgss_shmem_startup(), pgstat_fetch_entry(), pgstat_read_statsfile(), pgstat_report_autovac(), pgstat_report_recovery_conflict(), pgstat_shutdown_hook(), pgstat_wal_flush_cb(), pgstat_write_statsfile(), plan_create_index_workers(), PostgresMain(), PostgresSingleUserMain(), postmaster_child_launch(), PredicateLockShmemInit(), process_postgres_switches(), process_settings(), ProcessConfigFile(), ProcessConfigFileInternal(), ProcessStartupProcInterrupts(), ReadRecord(), readRecoverySignalFile(), RegisterBackgroundWorker(), RegisterDynamicBackgroundWorker(), ReplicationSlotAcquire(), SendPostmasterSignal(), SerialInit(), set_config_sourcefile(), set_config_with_handle(), SetMultiXactIdLimit(), SetTransactionIdLimit(), ShmemInitStruct(), SimpleLruInit(), standard_planner(), start_xact_command(), StatsShmemInit(), superuser_arg(), SyncScanShmemInit(), test_slru_shmem_startup(), TwoPhaseShmemInit(), vacuum_delay_point(), VarsupShmemInit(), verify_dictoptions(), WaitLatch(), WaitLatchOrSocket(), XLogArchiveNotify(), XLogPageRead(), XLogPrefetchIncrement(), XLogRecGetFullXid(), XLogShutdownWalRcv(), and XLogWrite().

local_preload_libraries_string

LogMemoryContextPending

PGDLLIMPORT volatile sig_atomic_t LogMemoryContextPending extern

maintenance_work_mem

Definition at line 133 of file globals.c.

Referenced by _brin_leader_participate_as_worker(), _brin_parallel_build_main(), _bt_leader_participate_as_worker(), _bt_parallel_build_main(), _bt_spools_heapscan(), _gin_leader_participate_as_worker(), _gin_parallel_build_main(), _h_spoolinit(), brinbuild(), bt_check_every_level(), dead_items_alloc(), ginbuild(), ginBuildCallback(), ginInsertCleanup(), gistbuild(), gistInitBuffering(), hashbuild(), heapam_relation_copy_for_cluster(), parallel_vacuum_init(), parallel_vacuum_main(), plan_cluster_use_sort(), plan_create_index_workers(), RI_Initial_Check(), RI_PartitionRemove_Check(), and validate_index().

max_parallel_maintenance_workers

max_parallel_workers

max_stack_depth

max_worker_processes

Definition at line 144 of file globals.c.

Referenced by BackgroundWorkerShmemInit(), BackgroundWorkerShmemSize(), BackgroundWorkerStateChange(), CheckRequiredParameterValues(), ForgetBackgroundWorker(), ForgetUnstartedBackgroundWorkers(), GetBackgroundWorkerPid(), InitControlFile(), InitializeMaxBackends(), InitPostmasterChildSlots(), InitProcGlobal(), RegisterBackgroundWorker(), ReportBackgroundWorkerExit(), ReportBackgroundWorkerPID(), TerminateBackgroundWorker(), and XLogReportParameters().

MaxBackends

Definition at line 146 of file globals.c.

Referenced by AioChooseMaxConcurrency(), AioProcs(), AsyncShmemInit(), AsyncShmemSize(), BTreeShmemInit(), BTreeShmemSize(), DeadLockCheckRecurse(), dsm_postmaster_startup(), ExpandConstraints(), FastPathLockShmemSize(), FindLockCycleRecurse(), FindLockCycleRecurseMember(), GetBlockerStatusData(), GetLockConflicts(), GetLockStatusData(), GetSerializableTransactionSnapshotInt(), GetSingleProcBlockerStatusData(), InitBufferManagerAccess(), InitDeadLockChecking(), InitializeMaxBackends(), InitProcGlobal(), pg_safe_snapshot_blocking_pids(), PGProcShmemSize(), pgstat_get_backend_current_activity(), pgstat_get_crashed_backend_activity(), predicatelock_twophase_recover(), PredicateLockShmemInit(), PredicateLockShmemSize(), ProcGlobalSemas(), SignalBackends(), TestConfiguration(), WaitForLSN(), WaitLSNShmemInit(), and WaitLSNShmemSize().

MaxConnections

Mode

multixact_member_buffers

multixact_offset_buffers

my_exec_path

Definition at line 81 of file globals.c.

Referenced by adjust_data_dir(), get_configdata(), get_doc_path(), get_etc_path(), get_extension_control_directories(), get_html_path(), get_include_path(), get_includeserver_path(), get_lib_path(), get_locale_path(), get_man_path(), get_pkginclude_path(), get_pkglib_path(), get_share_path(), get_tsearch_config_filename(), getInstallationPaths(), InitStandaloneProcess(), main(), make_relative_path(), ParseTzFile(), pg_bindtextdomain(), pg_config(), pg_TZDIR(), PostmasterMain(), process_psqlrc(), and set_pglocale_pgservice().

MyBackendType

Definition at line 64 of file miscinit.c.

Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), BackgroundWorkerMain(), BackgroundWriterMain(), CheckpointerMain(), CreateRestartPoint(), get_backend_type_for_log(), init_ps_display(), InitStandaloneProcess(), InvalidatePossiblyObsoleteSlot(), IoWorkerMain(), pgaio_init_backend(), pgaio_worker_error_callback(), PgArchiverMain(), pgstat_bestart_final(), pgstat_bestart_initial(), pgstat_count_backend_io_op(), pgstat_count_backend_io_op_time(), pgstat_count_io_op(), pgstat_flush_backend(), pgstat_io_flush_cb(), pgstat_should_report_connstat(), pgstat_write_statsfile(), PostgresMain(), ProcessStartupPacket(), ReplSlotSyncWorkerMain(), send_message_to_server_log(), standard_ProcessUtility(), StartupProcessMain(), SysLoggerMain(), WalReceiverMain(), WalSummarizerMain(), WalWriterMain(), write_csvlog(), and write_jsonlog().

MyCancelKey

MyCancelKeyLength

MyDatabaseHasLoginEventTriggers

MyDatabaseId

Definition at line 94 of file globals.c.

Referenced by AfterTriggerSetState(), AlterDatabase(), AlterObjectRename_internal(), AlterPublicationOwner_internal(), AlterSchemaOwner_internal(), AlterSubscription(), AlterSubscriptionOwner(), AlterSubscriptionOwner_internal(), asyncQueueNotificationToEntry(), asyncQueueProcessPageEntries(), ATExecDetachPartition(), AutoVacuumRequestWork(), CacheInvalidateCatalog(), CacheInvalidateHeapTupleCommon(), CacheInvalidateRelcache(), CacheInvalidateRelcacheByTuple(), CacheInvalidateRelSync(), check_default_table_access_method(), check_default_tablespace(), check_default_text_search_config(), check_temp_tablespaces(), CheckLogicalDecodingRequirements(), CheckMyDatabase(), checkSharedDependencies(), checkTempNamespaceStatus(), classIdGetDbId(), ComputeXidHorizons(), ConditionalLockDatabaseObject(), create_pg_locale_builtin(), create_pg_locale_icu(), create_pg_locale_libc(), CreateDecodingContext(), CreateInitDecodingContext(), CreatePublication(), CreateSchemaCommand(), CreateSubscription(), current_database(), database_to_xml_internal(), DeconstructQualifiedName(), do_analyze_rel(), do_autovacuum(), dropdb(), DropSubscription(), EventTriggerOnLogin(), Exec_ListenPreCommit(), exec_object_restorecon(), exec_replication_command(), ExecuteTruncateGuts(), ExpandColumnRefStar(), ExportSnapshot(), extension_is_trusted(), find_funcstat_entry(), find_tabstat_entry(), get_subscription_oid(), GetCurrentVirtualXIDs(), GetNewRelFileNumber(), GetOldestActiveTransactionId(), GetRunningTransactionData(), heap_inplace_update_and_unlock(), heap_vacuum_rel(), IdentifySystem(), ImportSnapshot(), init_database_collation(), initialize_acl(), InitializeParallelDSM(), InitPostgres(), InitTempTableNamespace(), InitWalSender(), InitWalSenderSlot(), libpqrcv_exec(), LocalExecuteInvalidationMessage(), LockApplyTransactionForSession(), LockDatabaseFrozenIds(), LockDatabaseObject(), LockGXact(), logical_heap_rewrite_flush_mappings(), logical_rewrite_log_mapping(), LogLogicalMessage(), LogStandbyInvalidations(), map_sql_catalog_to_xmlschema_types(), map_sql_schema_to_xmlschema_types(), map_sql_table_to_xmlschema(), map_sql_type_to_xml_name(), match_db_entries(), movedb(), perform_relmap_update(), perform_work_item(), pg_collation_actual_version(), pg_namespace_aclmask_ext(), pg_relation_filepath(), pg_stat_reset_single_function_counters(), pg_stat_reset_single_table_counters(), pgss_store(), pgstat_bestart_final(), pgstat_build_snapshot(), pgstat_copy_relation_stats(), pgstat_create_function(), pgstat_create_relation(), pgstat_drop_function(), pgstat_drop_relation(), pgstat_fetch_stat_funcentry(), pgstat_fetch_stat_tabentry_ext(), pgstat_init_function_usage(), pgstat_prep_database_pending(), pgstat_prep_relation_pending(), pgstat_report_analyze(), pgstat_report_connect(), pgstat_report_deadlock(), pgstat_report_disconnect(), pgstat_report_recovery_conflict(), pgstat_report_tempfile(), pgstat_report_vacuum(), pgstat_reset_counters(), pgstat_reset_database_timestamp(), pgstat_shutdown_hook(), pgstat_update_dbstats(), pgstat_update_parallel_workers_stats(), PostgresMain(), PrepareToInvalidateCacheTuple(), PrepareTransaction(), ProcArrayInstallImportedXmin(), ProcArrayInstallRestoredXmin(), RangeVarCallbackForStats(), RangeVarGetAndCheckCreationNamespace(), RangeVarGetCreationNamespace(), RangeVarGetRelidExtended(), read_stream_begin_impl(), ReindexMultipleTables(), RelationInitLockInfo(), RelationInitPhysicalAddr(), RelationMapFinishBootstrap(), RenameDatabase(), RenameSchema(), ReplicationSlotCreate(), roles_is_member_of(), ScanPgRelation(), SearchSysCacheLocked1(), sepgsql_schema_post_create(), SetDatabaseHasLoginEventTriggers(), SetLocktagRelationOid(), shdepDropOwned(), shdepReassignOwned(), SignalBackends(), transformColumnRef(), TwoPhaseGetOldestXidInCommit(), UnlockApplyTransactionForSession(), UnlockDatabaseObject(), UpdateLogicalMappings(), vac_truncate_clog(), vac_update_datfrozenxid(), vacuum_is_permitted_for_relation(), XactLogAbortRecord(), and XactLogCommitRecord().

MyDatabaseTableSpace

Definition at line 96 of file globals.c.

Referenced by AlterTableMoveAll(), ATPrepSetTableSpace(), calculate_tablespace_size(), check_temp_tablespaces(), CheckRelationTableSpaceMove(), DefineIndex(), DefineRelation(), ExecReindex(), FileSetInit(), get_tablespace(), get_tablespace_location(), GetDefaultTablespace(), GetNewRelFileNumber(), heap_create(), heap_inplace_update_and_unlock(), InitPostgres(), LogStandbyInvalidations(), OpenTemporaryFile(), perform_relmap_update(), pg_relation_filepath(), PrepareTempTablespaces(), ReindexMultipleInternal(), RelationInitPhysicalAddr(), RelationMapFinishBootstrap(), RelidByRelfilenumber(), SetRelationTableSpace(), XactLogAbortRecord(), and XactLogCommitRecord().

MyLatch

Definition at line 63 of file globals.c.

Referenced by ApplyLauncherMain(), autoprewarm_main(), AutoVacLauncherMain(), avl_sigusr2_handler(), BackgroundWriterMain(), CheckDeadLockAlert(), CheckpointerMain(), CheckpointWriteDelay(), ClientCheckTimeoutHandler(), ConditionVariableTimedSleep(), ConfigurePostmasterWaitSet(), copy_read_data(), die(), do_pg_backup_stop(), ExecAppendAsyncEventWait(), gather_readnext(), handle_pm_child_exit_signal(), handle_pm_pmsignal_signal(), handle_pm_reload_request_signal(), handle_pm_shutdown_request_signal(), handle_sig_alarm(), HandleCatchupInterrupt(), HandleNotifyInterrupt(), HandleParallelApplyMessageInterrupt(), HandleParallelMessageInterrupt(), IdleInTransactionSessionTimeoutHandler(), IdleSessionTimeoutHandler(), IdleStatsUpdateTimeoutHandler(), InitializeLatchWaitSet(), InitProcessLocalLatch(), IoWorkerMain(), lazy_truncate_heap(), libpqsrv_cancel(), libpqsrv_connect_internal(), libpqsrv_get_result(), LogicalParallelApplyLoop(), logicalrep_worker_stop_internal(), LogicalRepApplyLoop(), mq_putmessage(), pa_send_data(), pa_wait_for_xact_state(), pg_promote(), pg_sleep(), pg_wait_until_termination(), pgaio_worker_die(), pgaio_worker_register(), pgarch_MainLoop(), pgarch_waken_stop(), pgfdw_get_cleanup_result(), pq_check_connection(), pq_init(), ProcessClientReadInterrupt(), ProcessClientWriteInterrupt(), ProcessPendingWrites(), procsignal_sigusr1_handler(), ProcSleep(), ProcWaitForSignal(), ReqShutdownXLOG(), secure_read(), secure_write(), ServerLoop(), shm_mq_receive_bytes(), shm_mq_send_bytes(), shm_mq_wait_internal(), ShutDownSlotSync(), SignalHandlerForConfigReload(), SignalHandlerForShutdownRequest(), sigUsr1Handler(), StatementCancelHandler(), summarizer_wait_for_wal(), SwitchBackToLocalLatch(), SwitchToSharedLatch(), SyncRepWaitForLSN(), SysLoggerMain(), test_shm_mq_pipelined(), throttle(), TransactionTimeoutHandler(), wait_for_slot_activity(), wait_for_table_state_change(), wait_for_worker_state_change(), wait_for_workers_to_become_ready(), WaitForBackgroundWorkerShutdown(), WaitForBackgroundWorkerStartup(), WaitForLSN(), WaitForParallelWorkersToAttach(), WaitForParallelWorkersToFinish(), WaitForReplicationWorkerAttach(), WalRcvWaitForStartPosition(), WalReceiverMain(), WalSndLastCycleHandler(), WalSndLoop(), WalSndWaitForWal(), WalWriterMain(), and worker_spi_main().

MyPMChildSlot

MyProcPid

Definition at line 47 of file globals.c.

Referenced by AddWaitEventToSet(), ApplyLauncherMain(), apw_detach_shmem(), apw_dump_now(), apw_load_buffers(), apw_start_database_worker(), apw_start_leader_worker(), Async_Listen(), Async_Unlisten(), Async_UnlistenAll(), asyncQueueNotificationToEntry(), asyncQueueReadAllNotifications(), ATExecMergePartitions(), ATExecSplitPartition(), autoprewarm_main(), AutoVacLauncherMain(), basic_archive_file(), CheckpointerMain(), CleanupProcSignalState(), DisownLatch(), Exec_ListenPreCommit(), Exec_UnlistenAllCommit(), Exec_UnlistenCommit(), ExportSnapshot(), FileSetInit(), fork_process(), get_backend_type_for_log(), GetSerializableTransactionSnapshotInt(), HandleWalSndInitStopping(), InitAuxiliaryProcess(), initialize_prng(), InitializeParallelDSM(), InitializeWaitEventSupport(), InitLatch(), InitPostmasterDeathWatchHandle(), InitProcess(), InitProcessGlobals(), InitWalSenderSlot(), injection_point_allowed(), injection_points_attach(), InvalidatePossiblyObsoleteSlot(), IsLogicalLauncher(), LaunchParallelWorkers(), llvm_compile_module(), LockAcquireExtended(), LockTimeoutHandler(), log_status_format(), logicalrep_worker_launch(), main(), ModifyWaitEvent(), OpenTemporaryFileInTablespace(), OwnLatch(), pg_backend_pid(), pgstat_bestart_initial(), PostgresMain(), PostmasterMain(), proc_exit(), process_pgfdw_appname(), ProcessLogMemoryContextInterrupt(), ProcSignalInit(), ProcSleep(), ReplicationOriginExitCleanup(), ReplicationSlotAcquire(), ReplicationSlotCleanup(), ReplicationSlotCreate(), ReplicationSlotsDropDBSlots(), replorigin_session_setup(), ReplSlotSyncWorkerMain(), ResetLatch(), ServerLoop(), SetLatch(), setup_background_workers(), SharedInvalBackendInit(), SignalBackends(), SnapBuildSerialize(), StatementTimeoutHandler(), SyncReplicationSlots(), WakeupMyProc(), WalRcvDie(), WalReceiverMain(), worker_spi_launch(), write_csvlog(), write_jsonlog(), write_pipe_chunks(), and write_relcache_init_file().

MyProcPort

Definition at line 51 of file globals.c.

Referenced by appendSCRAMKeysInfo(), assign_tcp_keepalives_count(), assign_tcp_keepalives_idle(), assign_tcp_keepalives_interval(), assign_tcp_user_timeout(), BackendInitialize(), BackendMain(), check_conn_params(), connect_pg_server(), dblink_connstr_check(), dblink_connstr_has_required_scram_options(), dblink_security_check(), get_connect_string(), inet_client_addr(), inet_client_port(), inet_server_addr(), inet_server_port(), InitPostgres(), internal_flush_buffer(), log_disconnections(), log_status_format(), pgfdw_has_required_scram_options(), pgfdw_security_check(), pgstat_bestart_initial(), pgstat_bestart_security(), PostgresMain(), pq_getbyte_if_available(), pq_recvbuf(), process_pgfdw_appname(), scram_exchange(), show_tcp_keepalives_count(), show_tcp_keepalives_idle(), show_tcp_keepalives_interval(), show_tcp_user_timeout(), socket_close(), socket_set_nonblocking(), ssl_cipher(), ssl_client_cert_present(), ssl_client_dn(), ssl_client_dn_field(), ssl_client_serial(), ssl_extension_info(), ssl_is_used(), ssl_issuer_dn(), ssl_issuer_field(), ssl_version(), start_xact_command(), validate_token(), write_csvlog(), and write_jsonlog().

MyStartTime

MyStartTimestamp

NBuffers

notify_buffers

OutputFileName

pkglib_path

PostmasterPid

ProcDiePending

process_shared_preload_libraries_done

process_shared_preload_libraries_in_progress

PGDLLIMPORT bool process_shared_preload_libraries_in_progress extern

process_shmem_requests_in_progress

ProcSignalBarrierPending

PGDLLIMPORT volatile sig_atomic_t ProcSignalBarrierPending extern

Definition at line 40 of file globals.c.

Referenced by BufferSync(), CheckpointWriteDelay(), HandleProcSignalBarrierInterrupt(), ProcessAutoVacLauncherInterrupts(), ProcessCheckpointerInterrupts(), ProcessInterrupts(), ProcessMainLoopInterrupts(), ProcessPgArchInterrupts(), ProcessProcSignalBarrier(), ProcessStartupProcInterrupts(), ProcessWalSummarizerInterrupts(), and ResetProcSignalBarrierBits().

QueryCancelHoldoffCount

QueryCancelPending

serializable_buffers

session_preload_libraries_string

shared_preload_libraries_string

shmem_request_hook

subtransaction_buffers

transaction_buffers

TransactionTimeoutPending

PGDLLIMPORT volatile sig_atomic_t TransactionTimeoutPending extern

VacuumBufferUsageLimit

VacuumCostActive

VacuumCostBalance

Definition at line 157 of file globals.c.

Referenced by AsyncReadBuffers(), compute_parallel_delay(), lazy_check_wraparound_failsafe(), MarkBufferDirty(), MarkBufferDirtyHint(), parallel_vacuum_main(), parallel_vacuum_process_all_indexes(), PinBufferForBlock(), vacuum(), vacuum_delay_point(), and VacuumUpdateCosts().

VacuumCostDelay

VacuumCostLimit

VacuumCostPageDirty

VacuumCostPageHit

VacuumCostPageMiss

work_mem

Definition at line 131 of file globals.c.

Referenced by _bt_parallel_scan_and_sort(), _bt_pendingfsm_init(), _bt_spools_heapscan(), adjust_foreign_grouping_path_cost(), array_sort_internal(), collectMatchBitmap(), compute_bitmap_pages(), connectby(), cost_append(), cost_material(), cost_rescan(), create_groupingsets_path(), create_incremental_sort_path(), create_merge_append_path(), create_sort_path(), CreateWorkExprContext(), crosstab(), exec_init_tuple_store(), ExecIncrementalSort(), ExecInitCteScan(), ExecInitRecursiveUnion(), ExecMakeTableFunctionResult(), ExecMaterial(), ExecSort(), final_cost_mergejoin(), get_crosstab_tuplestore(), get_hash_memory_limit(), GetCurrentFDWTuplestore(), ginInsertCleanup(), hash_create_memory(), initial_cost_mergejoin(), initialize_aggregate(), initialize_phase(), InitMaterializedSRF(), label_incrementalsort_with_costsize(), label_sort_with_costsize(), libpqrcv_processTuples(), MakeTransitionCaptureState(), materializeQueryResult(), materializeResult(), MultiExecBitmapIndexScan(), MultiExecBitmapOr(), ordered_set_startup(), plperl_return_next_internal(), pltcl_init_tuple_store(), populate_recordset_worker(), PortalCreateHoldStore(), postquel_start(), prepare_tuplestore(), roles_list_append(), storeRow(), switchToPresortedPrefixMode(), and tfuncFetchRows().