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 395 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 122 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 151 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 129 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 143 of file miscadmin.h.

RESUME_INTERRUPTS

#define RESUME_INTERRUPTS ( )

Value:

do { \

InterruptHoldoffCount--; \

} while(0)

Definition at line 135 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 482 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 336 of file miscadmin.h.

337{

339

340

348

350

351

352

353

354

355

356

357

358

359

368

369

370

371

372

ProcessingMode

Enumerator
BootstrapProcessing
InitProcessing
NormalProcessing

Definition at line 467 of file miscadmin.h.

AddToDataDirLockFile()

void AddToDataDirLockFile ( int target_line,
const char * str
)

Definition at line 1570 of file miscinit.c.

1571{

1572 int fd;

1573 int len;

1574 int lineno;

1575 char *srcptr;

1576 char *destptr;

1577 char srcbuffer[BLCKSZ];

1578 char destbuffer[BLCKSZ];

1579

1581 if (fd < 0)

1582 {

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

1587 return;

1588 }

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

1592 if (len < 0)

1593 {

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

1599 return;

1600 }

1601 srcbuffer[len] = '\0';

1602

1603

1604

1605

1606

1607 srcptr = srcbuffer;

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

1609 {

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

1611

1612 if (eol == NULL)

1613 break;

1614 srcptr = eol + 1;

1615 }

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

1617 destptr = destbuffer + (srcptr - srcbuffer);

1618

1619

1620

1621

1622

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

1624 {

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

1626 *destptr++ = '\n';

1627 }

1628

1629

1630

1631

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

1633 destptr += strlen(destptr);

1634

1635

1636

1637

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

1639 {

1640 srcptr++;

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

1642 srcptr);

1643 }

1644

1645

1646

1647

1648

1649 len = strlen(destbuffer);

1650 errno = 0;

1653 {

1655

1656 if (errno == 0)

1657 errno = ENOSPC;

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

1663 return;

1664 }

1668 {

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

1673 }

1676 {

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

1681 }

1682}

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 612 of file postinit.c.

613{

615

616

617

618

620

621

622

623

624

626

627

628

629

630

631

632

634

635

636

637

638

640

641

645

646

647

648

649

651

652

653

654

655

657

658

660

661

662

663

664

666}

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_set_returning_function(), 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 347 of file miscinit.c.

348{

349 struct stat stat_buf;

350

352

354 {

355 if (errno == ENOENT)

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

360 else

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

365 }

366

367

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

370 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),

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

373

374

375

376

377

378

379

380

381

382

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

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

386 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),

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

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

390#endif

391

392

393

394

395

396

397

398

399

400

401

402

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

406 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),

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

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

410#endif

411

412

413

414

415

416

417

418

419

420

421

422

423

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

426

429#endif

430

431

433}

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 3616 of file nodeHash.c.

3617{

3618 double mem_limit;

3619

3620

3622

3623

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

3625

3626 return (size_t) mem_limit;

3627}

double hash_mem_multiplier

References hash_mem_multiplier, Min, and work_mem.

Referenced by BuildTupleHashTable(), consider_groupingsets_paths(), cost_memoize_rescan(), create_setop_path(), create_unique_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 {

270 backendDesc = gettext_noop("not initialized");

271 break;

274 break;

276 backendDesc = gettext_noop("autovacuum launcher");

277 break;

279 backendDesc = gettext_noop("autovacuum worker");

280 break;

282 backendDesc = gettext_noop("client backend");

283 break;

285 backendDesc = gettext_noop("dead-end client backend");

286 break;

288 backendDesc = gettext_noop("background worker");

289 break;

291 backendDesc = gettext_noop("background writer");

292 break;

295 break;

298 break;

301 break;

303 backendDesc = gettext_noop("slotsync worker");

304 break;

306 backendDesc = gettext_noop("standalone backend");

307 break;

310 break;

313 break;

316 break;

319 break;

322 break;

323 }

324

325 return backendDesc;

326}

References B_ARCHIVER, B_AUTOVAC_LAUNCHER, B_AUTOVAC_WORKER, B_BACKEND, B_BG_WORKER, B_BG_WRITER, B_CHECKPOINTER, B_DEAD_END_BACKEND, B_INVALID, B_IO_WORKER, B_LOGGER, B_SLOTSYNC_WORKER, B_STANDALONE_BACKEND, B_STARTUP, B_WAL_RECEIVER, B_WAL_SENDER, B_WAL_SUMMARIZER, B_WAL_WRITER, and 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 559 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 520 of file miscinit.c.

References Assert(), CurrentUserId, and OidIsValid.

Referenced by AfterTriggerSaveEvent(), AggregateCreate(), 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(), 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(), do_setval(), DoCopy(), dropdb(), DropOwnedObjects(), DropRole(), DropSubscription(), DropTableSpace(), emit_audit_message(), EnableDisableRule(), examine_simple_variable(), examine_variable(), ExecAlterDefaultPrivilegesStmt(), ExecAlterExtensionContentsStmt(), ExecAlterExtensionStmt(), ExecAlterObjectDependsStmt(), ExecBuildGroupingEqual(), ExecBuildParamSetEqual(), ExecBuildSlotPartitionKeyDescription(), ExecBuildSlotValueDescription(), ExecCheckOneRelPerms(), 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_rel_from_relname(), 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_set_returning_function(), 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(), RangeVarCallbackForDropRelation(), RangeVarCallbackForLockTable(), RangeVarCallbackForPolicy(), RangeVarCallbackForReindexIndex(), RangeVarCallbackForRenameRule(), RangeVarCallbackForRenameTrigger(), 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(), shell_check_detail(), standard_ProcessUtility(), statext_is_compatible_clause(), stats_lock_check_privileges(), 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 663 of file miscinit.c.

664{

667}

static int SecurityRestrictionContext

References CurrentUserId, and SecurityRestrictionContext.

Referenced by AfterTriggerExecute(), amcheck_lock_relation_and_check(), 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 1039 of file miscinit.c.

1040{

1042 char *result;

1043

1046 {

1047 if (!noerr)

1049 (errcode(ERRCODE_UNDEFINED_OBJECT),

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

1051 result = NULL;

1052 }

1053 else

1054 {

1057 }

1058 return result;

1059}

#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 739 of file miscinit.c.

740{

741 bool result = false;

743

744

746 return true;

747

750 {

753 }

754 return result;

755}

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 555 of file postinit.c.

556{

558

559

562

565 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),

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

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

571}

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 761 of file miscinit.c.

763{

766 char *rname;

768

769

770

771

772

773

774

775

777 {

778 Assert(bypass_login_check);

779 return;

780 }

781

782

783

784

785

787

788

789

790

791

792

794

795

796

797

798 if (rolename != NULL)

799 {

803 (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),

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

805 }

806 else

807 {

811 (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),

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

813 }

814

816 roleid = rform->oid;

817 rname = NameStr(rform->rolname);

819

821

822

823

824

825

826

827

828

829

830

831

832

833

834

835

836

837

838

839

840

843

844

845

846

847

848

850 {

851

852

853

854

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

857 (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),

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

859 rname)));

860

861

862

863

864

865

866

867

868

869

870

871

872

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

878 (errcode(ERRCODE_TOO_MANY_CONNECTIONS),

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

880 rname)));

881 }

882

884}

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 891 of file miscinit.c.

892{

893

894

895

896

899

900

902

904

905

906

907

908

909

910

911

912

914

915

917}

#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 925 of file miscinit.c.

926{

928

929

931

932

933

934

935

937

939

940

943}

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 712 of file postinit.c.

716{

718 bool am_superuser;

719 char *fullpath;

721 int nfree = 0;

722

724

725

726

727

728

729

731

732

734

735

736

737

738

739

740 if (!bootstrap)

741 {

744 }

745

746

747

748

749

751

753

754

755

756

757

758 if (!bootstrap)

759 {

770 }

771

772

773

774

775

776

777

779 {

780

781

782

783

784

786

788

790

792

793

794

795

796

799 }

800

801

802

803

804

805

806

810

811

813

814

815

816

817

819

820

821

822

823

824

825

826

827

828

830

831

833 {

834

836

837 return;

838 }

839

840

841

842

843 if (!bootstrap)

844 {

845

848

849

850

851

852

853

854

856 }

857

858

859

860

861

862

863

864

865

867 {

869 am_superuser = true;

870 }

872 {

874 am_superuser = true;

877 (errcode(ERRCODE_UNDEFINED_OBJECT),

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

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

881 }

883 {

885 {

887 am_superuser = true;

888 }

889 else

890 {

894 }

895 }

896 else

897 {

898

902

907 }

908

909

911 {

913

915 }

916

917

918

919

921 {

923 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),

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

925 }

926

927

928

929

930

931

932

933

934

935

936

940 {

943 (errcode(ERRCODE_TOO_MANY_CONNECTIONS),

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

945 "SUPERUSER")));

946

949 (errcode(ERRCODE_TOO_MANY_CONNECTIONS),

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

951 "pg_use_reserved_connections")));

952 }

953

954

956 {

958

961 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),

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

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

964 "REPLICATION")));

965 }

966

967

968

969

970

971

972

974 {

975

978

979

982

983

985

986

988

989

991

992 return;

993 }

994

995

996

997

998

999

1000

1001

1002 if (bootstrap)

1003 {

1004 dboid = Template1DbOid;

1006 }

1007 else if (in_dbname != NULL)

1008 {

1011

1015 (errcode(ERRCODE_UNDEFINED_DATABASE),

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

1018 dboid = dbform->oid;

1019 }

1021 {

1022

1023

1024

1025

1026

1027

1028 if (!bootstrap)

1029 {

1032 }

1033 return;

1034 }

1035

1036

1037

1038

1039

1040

1041

1042

1043

1044

1045

1046

1047

1048

1049

1050

1051

1052

1053

1054

1055

1056

1057 if (!bootstrap)

1059

1060

1061

1062

1063

1064

1065 if (!bootstrap)

1066 {

1069

1073

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

1076 {

1077 if (in_dbname)

1079 (errcode(ERRCODE_UNDEFINED_DATABASE),

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

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

1082 else

1084 (errcode(ERRCODE_UNDEFINED_DATABASE),

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

1086 }

1087

1089

1091 {

1093 errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),

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

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

1096 }

1097

1100

1101 if (out_dbname)

1102 strcpy(out_dbname, dbname);

1103 }

1104

1105

1106

1107

1108

1109

1110

1111

1112

1113

1114

1115

1117

1118

1119

1120

1121

1122

1123

1124

1125

1126

1127

1128

1129

1131

1132

1133

1134

1135

1136

1137

1139

1140

1141

1142

1143

1145

1146 if (!bootstrap)

1147 {

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

1149 {

1150 if (errno == ENOENT)

1152 (errcode(ERRCODE_UNDEFINED_DATABASE),

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

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

1156 fullpath)));

1157 else

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

1161 fullpath)));

1162 }

1163

1165 }

1166

1168 pfree(fullpath);

1169

1170

1171

1172

1173

1174

1175

1177

1178

1180

1181

1182

1183

1184

1185

1186

1187 if (!bootstrap)

1190

1191

1192

1193

1194

1195

1198

1199

1201

1202

1205

1206

1207

1208

1209

1210

1211

1213

1214

1216

1217

1219

1220

1221

1222

1223

1224

1225

1226

1229

1230

1231 if (!bootstrap)

1233

1234

1235 if (!bootstrap)

1237}

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 )

Definition at line 1939 of file miscinit.c.

1940{

1941#ifdef ENABLE_NLS

1943 {

1945

1947 bindtextdomain(domain, locale_path);

1948 pg_bind_textdomain_codeset(domain);

1949 }

1950#endif

1951}

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

References get_locale_path(), MAXPGPATH, and my_exec_path.

Referenced by _PG_init().

pg_split_opts()

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

Definition at line 497 of file postinit.c.

498{

500

502

503 while (*optstr)

504 {

505 bool last_was_escape = false;

506

508

509

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

511 optstr++;

512

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

514 break;

515

516

517

518

519

520 while (*optstr)

521 {

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

523 break;

524

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

526 last_was_escape = true;

527 else

528 {

529 last_was_escape = false;

531 }

532

533 optstr++;

534 }

535

536

538 }

539

541}

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 404 of file utility.c.

405{

408 (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),

409

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

411 cmdname)));

412}

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(), do_setval(), DoCopy(), ExecCheckXactReadOnly(), lo_import_internal(), nextval_internal(), 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 3298 of file postgres.c.

3299{

3300

3302 return;

3304

3306 {

3310

3315 (errcode(ERRCODE_QUERY_CANCELED),

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

3319 (errcode(ERRCODE_ADMIN_SHUTDOWN),

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

3323 (errcode(ERRCODE_ADMIN_SHUTDOWN),

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

3326 {

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

3329

3330

3331

3332

3333

3335 }

3338 (errcode(ERRCODE_ADMIN_SHUTDOWN),

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

3342 (errcode(ERRCODE_ADMIN_SHUTDOWN),

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

3346 {

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

3349

3351 }

3352 else

3354 (errcode(ERRCODE_ADMIN_SHUTDOWN),

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

3356 }

3357

3359 {

3361

3362

3363

3364

3365

3366

3367

3369 {

3372 else

3375 }

3376 }

3377

3379 {

3380 QueryCancelPending = false;

3382

3385 (errcode(ERRCODE_CONNECTION_FAILURE),

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

3387 }

3388

3389

3390

3391

3392

3393

3394

3395

3396

3398 {

3399

3400

3401

3402

3403

3404

3405

3406

3408 }

3410 {

3411 bool lock_timeout_occurred;

3412 bool stmt_timeout_occurred;

3413

3415

3416

3417

3418

3419

3422

3423

3424

3425

3426

3427

3428

3429 if (lock_timeout_occurred && stmt_timeout_occurred &&

3431 lock_timeout_occurred = false;

3432

3433 if (lock_timeout_occurred)

3434 {

3437 (errcode(ERRCODE_LOCK_NOT_AVAILABLE),

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

3439 }

3440 if (stmt_timeout_occurred)

3441 {

3444 (errcode(ERRCODE_QUERY_CANCELED),

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

3446 }

3448 {

3451 (errcode(ERRCODE_QUERY_CANCELED),

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

3453 }

3454

3455

3456

3457

3458

3459

3461 {

3464 (errcode(ERRCODE_QUERY_CANCELED),

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

3466 }

3467 }

3468

3471

3473 {

3474

3475

3476

3477

3478

3479

3482 {

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

3485 (errcode(ERRCODE_IDLE_IN_TRANSACTION_SESSION_TIMEOUT),

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

3487 }

3488 }

3489

3491 {

3492

3495 {

3498 (errcode(ERRCODE_TRANSACTION_TIMEOUT),

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

3500 }

3501 }

3502

3504 {

3505

3508 {

3511 (errcode(ERRCODE_IDLE_SESSION_TIMEOUT),

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

3513 }

3514 }

3515

3516

3517

3518

3519

3522 {

3525 }

3526

3529

3532

3535

3538}

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 1697 of file miscinit.c.

1698{

1699 int fd;

1700 int len;

1701 long file_pid;

1702 char buffer[BLCKSZ];

1703

1705 if (fd < 0)

1706 {

1707

1708

1709

1710

1711

1712 switch (errno)

1713 {

1714 case ENOENT:

1715 case ENOTDIR:

1716

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

1721 return false;

1722 default:

1723

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

1728 return true;

1729 }

1730 }

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

1734 if (len < 0)

1735 {

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

1741 return true;

1742 }

1743 buffer[len] = '\0';

1745 file_pid = atol(buffer);

1746 if (file_pid == getpid())

1747 return true;

1748

1749

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

1753 return false;

1754}

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 670 of file miscinit.c.

References CurrentUserId, and SecurityRestrictionContext.

Referenced by AbortSubTransaction(), AbortTransaction(), AfterTriggerExecute(), amcheck_lock_relation_and_check(), 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 1769 of file miscinit.c.

1770{

1772 FILE *file;

1773 int ret;

1774 long file_major;

1775 long my_major;

1776 char *endptr;

1777 char file_version_string[64];

1778 const char *my_version_string = PG_VERSION;

1779

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

1781

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

1783

1785 if (!file)

1786 {

1787 if (errno == ENOENT)

1789 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),

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

1791 path),

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

1793 else

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

1797 }

1798

1799 file_version_string[0] = '\0';

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

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

1802

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

1805 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),

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

1807 path),

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

1809 full_path),

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

1811

1813

1814 if (my_major != file_major)

1816 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),

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

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

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

1820 file_version_string, my_version_string)));

1821}

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(), 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 AdvanceXLInsertBuffer(), AtInplace_Inval(), CompactCheckpointerRequestQueue(), errfinish(), errstart(), HeapTupleHeaderGetCmax(), log_newpage_buffer(), MemoryContextCreate(), pgaio_io_process_completion(), pgstat_prepare_report_checksum_failure(), PreInplace_Inval(), proc_exit_prepare(), ProcessClientWriteInterrupt(), ProcessInterrupts(), 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(), check_idle_replication_slot_timeout(), check_max_slot_wal_keep_size(), create_toast_table(), CreateDatabaseUsingFileCopy(), createdb(), CreateRole(), CreateTableSpace(), DefineCollation(), GetNewOidWithIndex(), GetNewRelFileNumber(), heap_create_with_catalog(), icu_validate_locale(), index_create(), index_update_stats(), InitPostgres(), InvalidatePossiblyObsoleteSlot(), LaunchMissingBackgroundProcesses(), mdunlinkfork(), MultiXactSetNextMXact(), PostmasterMain(), process_postgres_switches(), RelationSetNewRelfilenumber(), 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(), 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(), TwoPhaseShmemInit(), vacuum_delay_point(), VarsupShmemInit(), verify_dictoptions(), WaitLatch(), WaitLatchOrSocket(), XLogArchiveNotify(), XLogPageRead(), XLogPrefetchIncrement(), XLogRecGetFullXid(), 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(), and TestConfiguration().

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_backend_have_pending_cb(), 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(), 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(), 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(), stats_lock_check_privileges(), transformColumnRef(), 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(), GetDefaultTablespace(), GetNewRelFileNumber(), heap_create(), heap_inplace_update_and_unlock(), InitPostgres(), LogStandbyInvalidations(), OpenTemporaryFile(), perform_relmap_update(), pg_relation_filepath(), pg_tablespace_location(), 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_relation_state_change(), wait_for_slot_activity(), wait_for_worker_state_change(), wait_for_workers_to_become_ready(), WaitForBackgroundWorkerShutdown(), WaitForBackgroundWorkerStartup(), 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(), 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(), 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(), create_unique_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(), 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().