#include "pgtime.h"
Go to the source code of this file.
| #define AmBackgroundWriterProcess | ( | ) | (MyAuxProcType == BgWriterProcess) |
Definition at line 384 of file miscadmin.h.
Referenced by ForwardFsyncRequest().
| #define AmBootstrapProcess | ( | ) | (MyAuxProcType == BootstrapProcess) |
Definition at line 382 of file miscadmin.h.
| #define AmCheckpointerProcess | ( | ) | (MyAuxProcType == CheckpointerProcess) |
Definition at line 385 of file miscadmin.h.
Referenced by AbsorbFsyncRequests(), CheckpointWriteDelay(), ForwardFsyncRequest(), and mdinit().
| #define AmStartupProcess | ( | ) | (MyAuxProcType == StartupProcess) |
Definition at line 383 of file miscadmin.h.
Referenced by mdinit().
| #define AmWalReceiverProcess | ( | ) | (MyAuxProcType == WalReceiverProcess) |
Definition at line 387 of file miscadmin.h.
Referenced by get_sync_bit().
| #define AmWalWriterProcess | ( | ) | (MyAuxProcType == WalWriterProcess) |
Definition at line 386 of file miscadmin.h.
| #define CHECK_FOR_INTERRUPTS | ( | ) |
do { \ if (InterruptPending) \ ProcessInterrupts(); \ } while(0)
Definition at line 90 of file miscadmin.h.
Referenced by _bt_buildadd(), _bt_steppage(), _bt_walk_left(), _hash_metapinit(), _hash_readnext(), _hash_readprev(), add_path(), analyze_rel(), ATRewriteTable(), backend_read_statsfile(), btree_xlog_delete_get_latestRemovedXid(), calculate_database_size(), calculate_relation_size(), calculate_tablespace_size(), ClientAuthentication(), cluster_rel(), copy_file(), copy_heap_data(), copy_relation_data(), copydir(), CopyFrom(), CopyTo(), count_nondeletable_pages(), CountOtherDBBackends(), db_dir_size(), do_autovacuum(), do_pg_stop_backup(), errfinish(), exec_execute_message(), exec_parse_message(), exec_replication_command(), exec_simple_query(), exec_stmt(), exec_stmts(), ExecHashJoin(), ExecMakeTableFunctionResult(), ExecProcNode(), ExecScan(), fsm_vacuum_page(), GetNewOidWithIndex(), GetNewRelFileNode(), getNextNearest(), ginbuild(), ginBuildCallback(), gingetbitmap(), ginInsertCleanup(), gistgetbitmap(), gistgettuple(), gistProcessItup(), HandleCatchupInterrupt(), HandleFunctionRequest(), HandleNotifyInterrupt(), heap_lock_updated_tuple_rec(), heapgetpage(), IndexBuildHeapScan(), IndexCheckExclusion(), lazy_truncate_heap(), make_bounded_heap(), md5_crypt_verify(), MultiExecBitmapIndexScan(), MultiExecProcNode(), numeric_fac(), pg_sleep(), PGSemaphoreLock(), pgstat_collect_oids(), pgstat_get_backend_current_activity(), pgstat_heap(), pgstat_index(), pgstat_read_current_status(), pgstat_vacuum_stat(), pgstatindex(), plperl_spi_prepare(), PortalRunMulti(), postgresAcquireSampleRowsFunc(), predicate_implied_by_simple_clause(), predicate_refuted_by_simple_clause(), prepare_for_client_read(), ProcessWalRcvInterrupts(), puttuple_common(), refresh_matview_datafill(), replace_text(), replace_text_regexp(), RequestCheckpoint(), sendDir(), spgdoinsert(), spgWalk(), storeQueryResult(), text_to_array_internal(), tuplesort_heap_insert(), tuplesort_heap_siftup(), vacuum_delay_point(), vacuum_rel(), validate_index_heapscan(), and WalSndLoop().
| #define DATEORDER_DMY 1 |
Definition at line 199 of file miscadmin.h.
Referenced by check_datestyle(), DecodeNumber(), EncodeDateOnly(), EncodeDateTime(), and setup_config().
| #define DATEORDER_MDY 2 |
Definition at line 200 of file miscadmin.h.
Referenced by check_datestyle(), and setup_config().
| #define DATEORDER_YMD 0 |
Definition at line 198 of file miscadmin.h.
Referenced by check_datestyle(), DecodeNumber(), and setup_config().
| #define END_CRIT_SECTION | ( | ) |
do { \ Assert(CritSectionCount > 0); \ CritSectionCount--; \ } while(0)
Definition at line 117 of file miscadmin.h.
Referenced by _bt_delitems_delete(), _bt_delitems_vacuum(), _bt_getroot(), _bt_insertonpg(), _bt_log_reuse_page(), _bt_newroot(), _bt_pagedel(), _bt_split(), _hash_expandtable(), AbsorbFsyncRequests(), addLeafTuple(), AlterSequence(), CreateCheckPoint(), CreateEndOfRecoveryRecord(), CreateMultiXactId(), createPostingTree(), do_setval(), doPickSplit(), EndPrepare(), fill_seq_with_data(), ginbuild(), ginbuildempty(), ginbulkdelete(), ginDeletePage(), ginHeapTupleFastInsert(), ginInsertValue(), ginUpdateStats(), ginVacuumPostingTreeLeaves(), gistbuild(), gistbuildempty(), gistbulkdelete(), gistplacetopage(), heap_delete(), heap_inplace_update(), heap_insert(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_multi_insert(), heap_page_prune(), heap_update(), lazy_vacuum_page(), log_newpage(), moveLeafs(), nextval_internal(), PostPrepare_Locks(), RecordTransactionAbort(), RecordTransactionAbortPrepared(), RecordTransactionCommit(), RecordTransactionCommitPrepared(), shiftList(), SlruPhysicalWritePage(), spgAddNodeAction(), spgbuild(), spgSplitNodeAction(), UpdateFullPageWrites(), vacuumLeafPage(), vacuumLeafRoot(), vacuumRedirectAndPlaceholder(), visibilitymap_set(), write_relmap_file(), writeListPage(), XLogBackgroundFlush(), XLogFlush(), and XLogInsert().
| #define GetProcessingMode | ( | ) | Mode |
Definition at line 349 of file miscadmin.h.
| #define HOLD_INTERRUPTS | ( | ) | (InterruptHoldoffCount++) |
Definition at line 107 of file miscadmin.h.
Referenced by AbortSubTransaction(), AbortTransaction(), AutoVacLauncherMain(), AutoVacWorkerMain(), BackgroundWriterMain(), CheckpointerMain(), CommitTransaction(), do_autovacuum(), do_start_bgworker(), LWLockAcquire(), LWLockAcquireOrWait(), LWLockConditionalAcquire(), LWLockReleaseAll(), PostgresMain(), PrepareTransaction(), and WalWriterMain().
| #define INTSTYLE_ISO_8601 3 |
Definition at line 215 of file miscadmin.h.
Referenced by EncodeInterval().
| #define INTSTYLE_POSTGRES 0 |
Definition at line 212 of file miscadmin.h.
Referenced by EncodeInterval(), and set_transmission_modes().
| #define INTSTYLE_POSTGRES_VERBOSE 1 |
Definition at line 213 of file miscadmin.h.
Referenced by EncodeInterval().
| #define INTSTYLE_SQL_STANDARD 2 |
Definition at line 214 of file miscadmin.h.
Referenced by DecodeInterval(), and EncodeInterval().
| #define IsBootstrapProcessingMode | ( | ) | (Mode == BootstrapProcessing) |
Definition at line 345 of file miscadmin.h.
Referenced by AtEOXact_cleanup(), CacheInvalidateHeapTuple(), create_toast_table(), DefineIndex(), ExecUpdate(), formrdesc(), get_type_io_data(), get_user_default_acl(), GetNewOid(), GetNewTransactionId(), heap_create_with_catalog(), heap_inplace_update(), index_constraint_create(), index_create(), index_update_stats(), IndexBuildHeapScan(), initialize_acl(), InitializeSearchPath(), InitializeSessionUserId(), InitPostgres(), InitXLOGAccess(), mdcreate(), mdopen(), RangeVarGetAndCheckCreationNamespace(), recordMultipleDependencies(), recordSharedDependencyOn(), regclassin(), regclassout(), regoperin(), regoperout(), regprocin(), regprocout(), regtypein(), regtypeout(), RelationCacheInitializePhase2(), RelationCacheInitializePhase3(), RelationDecrementReferenceCount(), RelationIncrementReferenceCount(), RelationMapFinishBootstrap(), RelationMapInitializePhase2(), RelationMapInitializePhase3(), RelationMapUpdateMap(), SearchCatCache(), TypeCreate(), TypeShellMake(), XLogInsert(), and XLOGShmemInit().
| #define IsInitProcessingMode | ( | ) | (Mode == InitProcessing) |
Definition at line 346 of file miscadmin.h.
Referenced by BackgroundWorkerInitializeConnection().
| #define IsNormalProcessingMode | ( | ) | (Mode == NormalProcessing) |
Definition at line 347 of file miscadmin.h.
Referenced by heap_create_with_catalog(), index_constraint_create(), and index_create().
| #define LOCK_FILE_LINE_DATA_DIR 2 |
Definition at line 426 of file miscadmin.h.
| #define LOCK_FILE_LINE_LISTEN_ADDR 6 |
Definition at line 430 of file miscadmin.h.
Referenced by PostmasterMain(), and test_postmaster_connection().
| #define LOCK_FILE_LINE_PID 1 |
Definition at line 425 of file miscadmin.h.
Referenced by test_postmaster_connection().
| #define LOCK_FILE_LINE_PORT 4 |
Definition at line 428 of file miscadmin.h.
Referenced by get_sock_dir(), and test_postmaster_connection().
| #define LOCK_FILE_LINE_SHMEM_KEY 7 |
Definition at line 431 of file miscadmin.h.
Referenced by InternalIpcMemoryCreate().
| #define LOCK_FILE_LINE_SOCKET_DIR 5 |
Definition at line 429 of file miscadmin.h.
Referenced by get_sock_dir(), PostmasterMain(), and test_postmaster_connection().
| #define LOCK_FILE_LINE_START_TIME 3 |
Definition at line 427 of file miscadmin.h.
Referenced by test_postmaster_connection().
| #define MAXTZLEN 10 |
Definition at line 228 of file miscadmin.h.
Referenced by abstime2tm(), and EncodeDateTime().
| #define PG_BACKEND_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n" |
Definition at line 29 of file miscadmin.h.
Referenced by adjust_data_dir(), do_start(), getInstallationPaths(), and setup_bin_paths().
| #define RESUME_INTERRUPTS | ( | ) |
do { \ Assert(InterruptHoldoffCount > 0); \ InterruptHoldoffCount--; \ } while(0)
Definition at line 109 of file miscadmin.h.
Referenced by AbortSubTransaction(), AbortTransaction(), AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), CommitTransaction(), do_autovacuum(), LWLockAcquireOrWait(), LWLockConditionalAcquire(), LWLockRelease(), PostgresMain(), PrepareTransaction(), and WalWriterMain().
| #define SECURITY_LOCAL_USERID_CHANGE 0x0001 |
Definition at line 279 of file miscadmin.h.
Referenced by CreateSchemaCommand(), fmgr_security_definer(), InLocalUserIdChange(), ri_PerformCheck(), and ri_PlanCheck().
| #define SECURITY_RESTRICTED_OPERATION 0x0002 |
Definition at line 280 of file miscadmin.h.
Referenced by do_analyze_rel(), index_build(), InSecurityRestrictedOperation(), vacuum_rel(), and validate_index().
| #define SetProcessingMode | ( | mode | ) |
do { \ AssertArg((mode) == BootstrapProcessing || \ (mode) == InitProcessing || \ (mode) == NormalProcessing); \ Mode = (mode); \ } while(0)
Definition at line 351 of file miscadmin.h.
Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), AuxiliaryProcessMain(), BackgroundWorkerInitializeConnection(), BootstrapModeMain(), do_start_bgworker(), and PostgresMain().
| #define START_CRIT_SECTION | ( | ) | (CritSectionCount++) |
Definition at line 115 of file miscadmin.h.
Referenced by _bt_delitems_delete(), _bt_delitems_vacuum(), _bt_getroot(), _bt_insertonpg(), _bt_log_reuse_page(), _bt_newroot(), _bt_pagedel(), _bt_split(), _hash_expandtable(), AbsorbFsyncRequests(), addLeafTuple(), AlterSequence(), CreateCheckPoint(), CreateEndOfRecoveryRecord(), createPostingTree(), do_setval(), doPickSplit(), EndPrepare(), fill_seq_with_data(), GetNewMultiXactId(), ginbuild(), ginbuildempty(), ginbulkdelete(), ginDeletePage(), ginHeapTupleFastInsert(), ginInsertValue(), ginUpdateStats(), ginVacuumPostingTreeLeaves(), gistbuild(), gistbuildempty(), gistbulkdelete(), gistplacetopage(), heap_delete(), heap_inplace_update(), heap_insert(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_multi_insert(), heap_page_prune(), heap_update(), lazy_vacuum_page(), log_newpage(), moveLeafs(), nextval_internal(), PostPrepare_Locks(), RecordTransactionAbort(), RecordTransactionAbortPrepared(), RecordTransactionCommit(), RecordTransactionCommitPrepared(), shiftList(), SlruPhysicalWritePage(), spgAddNodeAction(), spgbuild(), spgSplitNodeAction(), UpdateFullPageWrites(), vacuumLeafPage(), vacuumLeafRoot(), vacuumRedirectAndPlaceholder(), visibilitymap_set(), write_relmap_file(), writeListPage(), XLogBackgroundFlush(), XLogFlush(), and XLogInsert().
| #define USE_GERMAN_DATES 3 |
Definition at line 194 of file miscadmin.h.
Referenced by check_datestyle(), EncodeDateOnly(), and EncodeDateTime().
| #define USE_ISO_DATES 1 |
Definition at line 192 of file miscadmin.h.
Referenced by check_datestyle(), EncodeDateOnly(), EncodeDateTime(), set_transmission_modes(), and timestamptz_to_str().
| #define USE_POSTGRES_DATES 0 |
Definition at line 191 of file miscadmin.h.
Referenced by check_datestyle(), EncodeDateOnly(), and EncodeDateTime().
| #define USE_SQL_DATES 2 |
Definition at line 193 of file miscadmin.h.
Referenced by check_datestyle(), EncodeDateOnly(), and EncodeDateTime().
| #define USE_XSD_DATES 4 |
Definition at line 195 of file miscadmin.h.
Referenced by EncodeDateOnly(), EncodeDateTime(), EncodeTimezone(), and map_sql_value_to_xml_value().
| typedef char* pg_stack_base_t |
Definition at line 258 of file miscadmin.h.
| typedef enum ProcessingMode ProcessingMode |
| enum AuxProcType |
| NotAnAuxProcess | |
| CheckerProcess | |
| BootstrapProcess | |
| StartupProcess | |
| BgWriterProcess | |
| CheckpointerProcess | |
| WalWriterProcess | |
| WalReceiverProcess | |
| NUM_AUXPROCTYPES |
Definition at line 366 of file miscadmin.h.
{
NotAnAuxProcess = -1,
CheckerProcess = 0,
BootstrapProcess,
StartupProcess,
BgWriterProcess,
CheckpointerProcess,
WalWriterProcess,
WalReceiverProcess,
NUM_AUXPROCTYPES /* Must be last! */
} AuxProcType;
| enum ProcessingMode |
Definition at line 336 of file miscadmin.h.
{
BootstrapProcessing, /* bootstrap creation of template database */
InitProcessing, /* initializing system */
NormalProcessing /* normal processing */
} ProcessingMode;
| void AddToDataDirLockFile | ( | int | target_line, | |
| const char * | str | |||
| ) |
Definition at line 107 of file ipc_test.c.
References close, DIRECTORY_LOCK_FILE, elog, ereport, errcode_for_file_access(), errmsg(), LOG, NULL, PG_BINARY, pg_fsync(), read, snprintf(), and write.
Referenced by InternalIpcMemoryCreate(), and PostmasterMain().
{
}
| bool BackupInProgress | ( | void | ) |
Definition at line 9284 of file xlog.c.
References BACKUP_LABEL_FILE.
Referenced by pg_is_in_backup(), and PostmasterStateMachine().
{
struct stat stat_buf;
return (stat(BACKUP_LABEL_FILE, &stat_buf) == 0);
}
| void BaseInit | ( | void | ) |
Definition at line 460 of file postinit.c.
References DebugFileOpen(), InitBufferPoolAccess(), InitCommunication(), InitFileAccess(), and smgrinit().
Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), AuxiliaryProcessMain(), do_start_bgworker(), and PostgresMain().
{
/*
* Attach to shared memory and semaphores, and initialize our
* input/output/debugging file descriptors.
*/
InitCommunication();
DebugFileOpen();
/* Do local initialization of file, storage and buffer managers */
InitFileAccess();
smgrinit();
InitBufferPoolAccess();
}
| void CancelBackup | ( | void | ) |
Definition at line 9299 of file xlog.c.
References BACKUP_LABEL_FILE, BACKUP_LABEL_OLD, ereport, errcode_for_file_access(), errdetail(), errmsg(), LOG, unlink(), and WARNING.
Referenced by PostmasterStateMachine().
{
struct stat stat_buf;
/* if the file is not there, return */
if (stat(BACKUP_LABEL_FILE, &stat_buf) < 0)
return;
/* remove leftover file from previously canceled backup if it exists */
unlink(BACKUP_LABEL_OLD);
if (rename(BACKUP_LABEL_FILE, BACKUP_LABEL_OLD) == 0)
{
ereport(LOG,
(errmsg("online backup mode canceled"),
errdetail("\"%s\" was renamed to \"%s\".",
BACKUP_LABEL_FILE, BACKUP_LABEL_OLD)));
}
else
{
ereport(WARNING,
(errcode_for_file_access(),
errmsg("online backup mode was not canceled"),
errdetail("Could not rename \"%s\" to \"%s\": %m.",
BACKUP_LABEL_FILE, BACKUP_LABEL_OLD)));
}
}
| void ChangeToDataDir | ( | void | ) |
Definition at line 109 of file miscinit.c.
References AssertState, DataDir, ereport, errcode_for_file_access(), errmsg(), and FATAL.
Referenced by AuxiliaryProcessMain(), PostgresMain(), and PostmasterMain().
{
AssertState(DataDir);
if (chdir(DataDir) < 0)
ereport(FATAL,
(errcode_for_file_access(),
errmsg("could not change directory to \"%s\": %m",
DataDir)));
}
| void check_stack_depth | ( | void | ) |
Definition at line 3051 of file postgres.c.
References ereport, errcode(), errhint(), errmsg(), ERROR, max_stack_depth, max_stack_depth_bytes, NULL, and stack_base_ptr.
Referenced by addone(), clean_fakeval_intree(), clean_NOT_intree(), cntsize(), contains_required_value(), copyObject(), Cover(), dofindsubquery(), EventTriggerInvoke(), ExecInitExpr(), ExecMakeFunctionResult(), ExecMakeFunctionResultNoSets(), execute(), expression_tree_mutator(), expression_tree_walker(), fillQT(), findoprnd_recurse(), freetree(), infix(), inline_set_returning_function(), JumbleExpr(), makepol(), plainnode(), plperl_hash_from_tuple(), plperl_sv_to_datum(), QT2QTN(), QTNBinary(), QTNClearFlags(), QTNCopy(), QTNFree(), QTNodeCompare(), QTNSort(), QTNTernary(), raw_expression_tree_walker(), split_array(), transformExprRecurse(), transformSetOperationTree(), TS_execute(), tsquery_opr_selec(), and tsquery_requires_match().
{
char stack_top_loc;
long stack_depth;
/*
* Compute distance from reference point to my local variables
*/
stack_depth = (long) (stack_base_ptr - &stack_top_loc);
/*
* Take abs value, since stacks grow up on some machines, down on others
*/
if (stack_depth < 0)
stack_depth = -stack_depth;
/*
* Trouble?
*
* The test on stack_base_ptr prevents us from erroring out if called
* during process setup or in a non-backend process. Logically it should
* be done first, but putting it here avoids wasting cycles during normal
* cases.
*/
if (stack_depth > max_stack_depth_bytes &&
stack_base_ptr != NULL)
{
ereport(ERROR,
(errcode(ERRCODE_STATEMENT_TOO_COMPLEX),
errmsg("stack depth limit exceeded"),
errhint("Increase the configuration parameter \"max_stack_depth\" (currently %dkB), "
"after ensuring the platform's stack depth limit is adequate.",
max_stack_depth)));
}
/*
* On IA64 there is a separate "register" stack that requires its own
* independent check. For this, we have to measure the change in the
* "BSP" pointer from PostgresMain to here. Logic is just as above,
* except that we know IA64's register stack grows up.
*
* Note we assume that the same max_stack_depth applies to both stacks.
*/
#if defined(__ia64__) || defined(__ia64)
stack_depth = (long) (ia64_get_bsp() - register_stack_base_ptr);
if (stack_depth > max_stack_depth_bytes &&
register_stack_base_ptr != NULL)
{
ereport(ERROR,
(errcode(ERRCODE_STATEMENT_TOO_COMPLEX),
errmsg("stack depth limit exceeded"),
errhint("Increase the configuration parameter \"max_stack_depth\" (currently %dkB), "
"after ensuring the platform's stack depth limit is adequate.",
max_stack_depth)));
}
#endif /* IA64 */
}
| void CreateDataDirLockFile | ( | bool | amPostmaster | ) |
Definition at line 972 of file miscinit.c.
References CreateLockFile(), DataDir, and DIRECTORY_LOCK_FILE.
Referenced by AuxiliaryProcessMain(), PostgresMain(), and PostmasterMain().
{
CreateLockFile(DIRECTORY_LOCK_FILE, amPostmaster, "", true, DataDir);
}
| void CreateSocketLockFile | ( | const char * | socketfile, | |
| bool | amPostmaster, | |||
| const char * | socketDir | |||
| ) |
Definition at line 981 of file miscinit.c.
References CreateLockFile(), and snprintf().
{
char lockfile[MAXPGPATH];
snprintf(lockfile, sizeof(lockfile), "%s.lock", socketfile);
CreateLockFile(lockfile, amPostmaster, socketDir, false, socketfile);
}
| Oid GetCurrentRoleId | ( | void | ) |
Definition at line 555 of file miscinit.c.
References OuterUserId, and SetRoleIsActive.
Referenced by show_role().
{
if (SetRoleIsActive)
return OuterUserId;
else
return InvalidOid;
}
| Oid GetOuterUserId | ( | void | ) |
Definition at line 252 of file miscinit.c.
References AssertState, OidIsValid, and OuterUserId.
Referenced by DropRole(), and RenameRole().
{
AssertState(OidIsValid(OuterUserId));
return OuterUserId;
}
| Oid GetSessionUserId | ( | void | ) |
Definition at line 275 of file miscinit.c.
References AssertState, OidIsValid, and SessionUserId.
Referenced by check_role(), DropRole(), InitPostgres(), pgstat_bestart(), RenameRole(), and session_user().
{
AssertState(OidIsValid(SessionUserId));
return SessionUserId;
}
| Oid GetUserId | ( | void | ) |
Definition at line 241 of file miscinit.c.
References AssertState, CurrentUserId, and OidIsValid.
Referenced by AddRoleMems(), AggregateCreate(), AlterDatabase(), AlterDatabaseOwner(), AlterDatabaseSet(), AlterEventTrigger(), AlterEventTriggerOwner_internal(), AlterExtensionNamespace(), AlterForeignServer(), AlterForeignServerOwner_internal(), AlterFunction(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterOpFamilyAdd(), AlterRole(), AlterRoleSet(), AlterSchemaOwner_internal(), AlterSequence(), AlterTableSpaceOptions(), AlterTSConfiguration(), AlterTSDictionary(), AlterTypeNamespace_oid(), AlterTypeOwner(), analyze_rel(), ATExecAddColumn(), ATExecChangeOwner(), ATPrepAlterColumnType(), ATPrepSetStatistics(), ATPrepSetTableSpace(), ATSimplePermissions(), BuildDescForRelation(), calculate_database_size(), calculate_tablespace_size(), check_temp_tablespaces(), checkDomainOwner(), checkEnumOwner(), checkFkeyPermissions(), CheckMyDatabase(), CheckRelationOwnership(), cluster_rel(), CommentObject(), compile_plperl_function(), compile_pltcl_function(), compute_return_type(), create_empty_extension(), CreateCast(), CreateConversionCommand(), createdb(), CreateEventTrigger(), CreateExtension(), CreateForeignDataWrapper(), CreateForeignServer(), CreateForeignTable(), CreateFunction(), CreateOpFamily(), CreateProceduralLanguage(), CreateRole(), CreateTableSpace(), CreateTrigger(), current_user(), currtid_byrelname(), currtid_byreloid(), currval_oid(), DefineAggregate(), DefineCollation(), DefineDomain(), DefineEnum(), DefineIndex(), DefineOpClass(), DefineOperator(), DefineOpFamily(), DefineQueryRewrite(), DefineRange(), DefineRelation(), DefineTSConfiguration(), DefineTSDictionary(), DefineType(), DelRoleMems(), do_pg_start_backup(), do_pg_stop_backup(), do_setval(), dropdb(), DropOwnedObjects(), DropRole(), DropTableSpace(), EnableDisableRule(), examine_parameter_list(), ExecAlterDefaultPrivilegesStmt(), ExecAlterExtensionContentsStmt(), ExecAlterExtensionStmt(), ExecCheckRTEPerms(), ExecEvalArrayCoerceExpr(), ExecGrant_Attribute(), ExecGrant_Database(), ExecGrant_Fdw(), ExecGrant_ForeignServer(), ExecGrant_Function(), ExecGrant_Language(), ExecGrant_Largeobject(), ExecGrant_Namespace(), ExecGrant_Relation(), ExecGrant_Tablespace(), ExecGrant_Type(), ExecInitAgg(), ExecInitWindowAgg(), ExecSecLabelStmt(), ExecuteDoStmt(), ExecuteTruncate(), findRangeCanonicalFunction(), findRangeSubtypeDiffFunction(), FinishPreparedTransaction(), get_connect_string(), get_other_operator(), get_rel_from_relname(), get_tables_to_cluster(), GetUserOidFromMapping(), 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_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(), init_fcache(), InitializeSearchPath(), InitPostgres(), InitTempTableNamespace(), inline_function(), inline_set_returning_function(), insert_username(), inv_create(), LargeObjectCreate(), lastval(), lo_read(), lo_truncate_internal(), lo_unlink(), lo_write(), LockTableAclCheck(), lookup_agg_function(), LookupCreationNamespace(), LookupExplicitNamespace(), MergeAttributes(), movedb(), nextval_internal(), OperatorCreate(), OperatorShellMake(), pg_has_role_id(), pg_has_role_name(), pg_sequence_parameters(), pg_signal_backend(), pg_stat_get_activity(), pg_stat_get_backend_activity(), pg_stat_get_backend_activity_start(), pg_stat_get_backend_client_addr(), pg_stat_get_backend_client_port(), pg_stat_get_backend_start(), pg_stat_get_backend_waiting(), pg_stat_get_backend_xact_start(), pg_stat_statements(), pgrowlocks(), pgss_store(), pgstat_get_backend_current_activity(), pltcl_fetch_interp(), postgresBeginForeignModify(), postgresBeginForeignScan(), postgresGetForeignRelSize(), PrepareTempTablespaces(), PrepareTransaction(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForDropRelation(), RangeVarCallbackForReindexIndex(), RangeVarCallbackForRenameRule(), RangeVarCallbackForRenameTrigger(), RangeVarCallbackOwnsTable(), RangeVarGetAndCheckCreationNamespace(), ReassignOwnedObjects(), recomputeNamespacePath(), ReindexDatabase(), RemoveObjects(), renameatt_check(), RenameDatabase(), RenameSchema(), RenameTableSpace(), RenameType(), select_perl_context(), superuser(), timetravel(), transformTableLikeClause(), truncate_check_rel(), user_mapping_ddl_aclcheck(), and vacuum_rel().
{
AssertState(OidIsValid(CurrentUserId));
return CurrentUserId;
}
Definition at line 369 of file miscinit.c.
References CurrentUserId, and InLocalUserIdChange().
{
*userid = CurrentUserId;
*sec_def_context = InLocalUserIdChange();
}
| void GetUserIdAndSecContext | ( | Oid * | userid, | |
| int * | sec_context | |||
| ) |
Definition at line 329 of file miscinit.c.
References CurrentUserId, and SecurityRestrictionContext.
Referenced by CreateSchemaCommand(), do_analyze_rel(), fmgr_security_definer(), index_build(), PushTransaction(), ri_PerformCheck(), ri_PlanCheck(), StartTransaction(), vacuum_rel(), and validate_index().
{
*userid = CurrentUserId;
*sec_context = SecurityRestrictionContext;
}
| char* GetUserNameFromId | ( | Oid | roleid | ) |
Definition at line 610 of file miscinit.c.
References AUTHOID, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum, pstrdup(), ReleaseSysCache(), and SearchSysCache1.
Referenced by check_is_member_of_role(), current_user(), getObjectDescription(), getObjectIdentity(), insert_username(), session_user(), and timetravel().
{
HeapTuple tuple;
char *result;
tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("invalid role OID: %u", roleid)));
result = pstrdup(NameStr(((Form_pg_authid) GETSTRUCT(tuple))->rolname));
ReleaseSysCache(tuple);
return result;
}
Definition at line 396 of file miscinit.c.
References AUTHOID, GETSTRUCT, HeapTupleIsValid, ObjectIdGetDatum, ReleaseSysCache(), and SearchSysCache1.
Referenced by do_pg_start_backup(), do_pg_stop_backup(), and InitPostgres().
{
bool result = false;
HeapTuple utup;
utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
if (HeapTupleIsValid(utup))
{
result = ((Form_pg_authid) GETSTRUCT(utup))->rolreplication;
ReleaseSysCache(utup);
}
return result;
}
| void InitializeMaxBackends | ( | void | ) |
Definition at line 438 of file postinit.c.
References Assert, autovacuum_max_workers, elog, ERROR, GetNumShmemAttachedBgworkers(), MAX_BACKENDS, MaxBackends, and MaxConnections.
Referenced by AuxiliaryProcessMain(), PostgresMain(), and PostmasterMain().
{
Assert(MaxBackends == 0);
/* the extra unit accounts for the autovacuum launcher */
MaxBackends = MaxConnections + autovacuum_max_workers + 1 +
GetNumShmemAttachedBgworkers();
/* internal error because the values were all checked previously */
if (MaxBackends > MAX_BACKENDS)
elog(ERROR, "too many backends configured");
}
| void InitializeSessionUserId | ( | const char * | rolename | ) |
Definition at line 414 of file miscinit.c.
References AssertState, AuthenticatedUserId, AuthenticatedUserIsSuperuser, AUTHNAME, CountUserBackends(), ereport, errcode(), errmsg(), FATAL, GETSTRUCT, HeapTupleGetOid, HeapTupleIsValid, IsBootstrapProcessingMode, IsUnderPostmaster, MyProc, OidIsValid, PGC_BACKEND, PGC_INTERNAL, PGC_S_OVERRIDE, PointerGetDatum, ReleaseSysCache(), PGPROC::roleId, SearchSysCache1, SetConfigOption(), and SetSessionUserId().
Referenced by InitPostgres().
{
HeapTuple roleTup;
Form_pg_authid rform;
Oid roleid;
/*
* Don't do scans if we're bootstrapping, none of the system catalogs
* exist yet, and they should be owned by postgres anyway.
*/
AssertState(!IsBootstrapProcessingMode());
/* call only once */
AssertState(!OidIsValid(AuthenticatedUserId));
roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(rolename));
if (!HeapTupleIsValid(roleTup))
ereport(FATAL,
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
errmsg("role \"%s\" does not exist", rolename)));
rform = (Form_pg_authid) GETSTRUCT(roleTup);
roleid = HeapTupleGetOid(roleTup);
AuthenticatedUserId = roleid;
AuthenticatedUserIsSuperuser = rform->rolsuper;
/* This sets OuterUserId/CurrentUserId too */
SetSessionUserId(roleid, AuthenticatedUserIsSuperuser);
/* Also mark our PGPROC entry with the authenticated user id */
/* (We assume this is an atomic store so no lock is needed) */
MyProc->roleId = roleid;
/*
* These next checks are not enforced when in standalone mode, so that
* there is a way to recover from sillinesses like "UPDATE pg_authid SET
* rolcanlogin = false;".
*/
if (IsUnderPostmaster)
{
/*
* Is role allowed to login at all?
*/
if (!rform->rolcanlogin)
ereport(FATAL,
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
errmsg("role \"%s\" is not permitted to log in",
rolename)));
/*
* Check connection limit for this role.
*
* There is a race condition here --- we create our PGPROC before
* checking for other PGPROCs. If two backends did this at about the
* same time, they might both think they were over the limit, while
* ideally one should succeed and one fail. Getting that to work
* exactly seems more trouble than it is worth, however; instead we
* just document that the connection limit is approximate.
*/
if (rform->rolconnlimit >= 0 &&
!AuthenticatedUserIsSuperuser &&
CountUserBackends(roleid) > rform->rolconnlimit)
ereport(FATAL,
(errcode(ERRCODE_TOO_MANY_CONNECTIONS),
errmsg("too many connections for role \"%s\"",
rolename)));
}
/* Record username and superuser status as GUC settings too */
SetConfigOption("session_authorization", rolename,
PGC_BACKEND, PGC_S_OVERRIDE);
SetConfigOption("is_superuser",
AuthenticatedUserIsSuperuser ? "on" : "off",
PGC_INTERNAL, PGC_S_OVERRIDE);
ReleaseSysCache(roleTup);
}
| void InitializeSessionUserIdStandalone | ( | void | ) |
Definition at line 498 of file miscinit.c.
References AssertState, AuthenticatedUserId, AuthenticatedUserIsSuperuser, BOOTSTRAP_SUPERUSERID, IsAutoVacuumWorkerProcess(), IsBackgroundWorker, IsUnderPostmaster, OidIsValid, and SetSessionUserId().
Referenced by InitPostgres().
{
/*
* This function should only be called in single-user mode, in
* autovacuum workers, and in background workers.
*/
AssertState(!IsUnderPostmaster || IsAutoVacuumWorkerProcess() || IsBackgroundWorker);
/* call only once */
AssertState(!OidIsValid(AuthenticatedUserId));
AuthenticatedUserId = BOOTSTRAP_SUPERUSERID;
AuthenticatedUserIsSuperuser = true;
SetSessionUserId(BOOTSTRAP_SUPERUSERID, true);
}
| void InitPostgres | ( | const char * | in_dbname, | |
| Oid | dboid, | |||
| const char * | username, | |||
| char * | out_dbname | |||
| ) |
Definition at line 498 of file postinit.c.
References am_walsender, Assert, CAC_WAITBACKUP, Port::canAcceptConnections, CheckDeadLock(), CheckMyDatabase(), CommitTransactionCommand(), PGPROC::databaseId, DatabaseRelationId, DEADLOCK_TIMEOUT, DEBUG3, elog, EnablePortalManager(), ereport, errcode(), errcode_for_file_access(), errdetail(), errhint(), errmsg(), FATAL, GetDatabasePath(), GetDatabaseTuple(), GetDatabaseTupleByOid(), GetSessionUserId(), GETSTRUCT, GetTransactionSnapshot(), GetUserId(), has_rolreplication(), HaveNFreeProcs(), HeapTupleGetOid, HeapTupleIsValid, InitBufferPoolBackend(), InitCatalogCache(), initialize_acl(), InitializeClientEncoding(), InitializeSearchPath(), InitializeSessionUserId(), InitializeSessionUserIdStandalone(), InitPlanCache(), InitProcessPhase2(), IsAutoVacuumLauncherProcess(), IsAutoVacuumWorkerProcess(), IsBackgroundWorker, IsBinaryUpgrade, IsBootstrapProcessingMode, IsUnderPostmaster, LOCK_TIMEOUT, LockSharedObject(), LockTimeoutHandler(), MaxBackends, MyBackendId, MyDatabaseId, MyDatabaseTableSpace, MyProc, MyProcPort, NameStr, NULL, on_shmem_exit(), PerformAuthentication(), pg_usleep(), pgstat_bestart(), pgstat_initialize(), PostAuthDelay, process_settings(), process_startup_options(), ProcSignalInit(), RecoveryInProgress(), RegisterTimeout(), RelationCacheInitialize(), RelationCacheInitializePhase2(), RelationCacheInitializePhase3(), ReservedBackends, RowExclusiveLock, SetCurrentStatementStartTimestamp(), SetDatabasePath(), SharedInvalBackendInit(), ShutdownPostgres(), ShutdownXLOG(), StartTransactionCommand(), StartupXLOG(), STATEMENT_TIMEOUT, StatementTimeoutHandler(), strlcpy(), superuser(), ThereIsAtLeastOneRole(), ValidatePgVersion(), WARNING, and XactIsoLevel.
Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), BackgroundWorkerInitializeConnection(), BootstrapModeMain(), and PostgresMain().
{
bool bootstrap = IsBootstrapProcessingMode();
bool am_superuser;
char *fullpath;
char dbname[NAMEDATALEN];
elog(DEBUG3, "InitPostgres");
/*
* Add my PGPROC struct to the ProcArray.
*
* Once I have done this, I am visible to other backends!
*/
InitProcessPhase2();
/*
* Initialize my entry in the shared-invalidation manager's array of
* per-backend data.
*
* Sets up MyBackendId, a unique backend identifier.
*/
MyBackendId = InvalidBackendId;
SharedInvalBackendInit(false);
if (MyBackendId > MaxBackends || MyBackendId <= 0)
elog(FATAL, "bad backend ID: %d", MyBackendId);
/* Now that we have a BackendId, we can participate in ProcSignal */
ProcSignalInit(MyBackendId);
/*
* Also set up timeout handlers needed for backend operation. We need
* these in every case except bootstrap.
*/
if (!bootstrap)
{
RegisterTimeout(DEADLOCK_TIMEOUT, CheckDeadLock);
RegisterTimeout(STATEMENT_TIMEOUT, StatementTimeoutHandler);
RegisterTimeout(LOCK_TIMEOUT, LockTimeoutHandler);
}
/*
* bufmgr needs another initialization call too
*/
InitBufferPoolBackend();
/*
* Initialize local process's access to XLOG.
*/
if (IsUnderPostmaster)
{
/*
* The postmaster already started the XLOG machinery, but we need to
* call InitXLOGAccess(), if the system isn't in hot-standby mode.
* This is handled by calling RecoveryInProgress and ignoring the
* result.
*/
(void) RecoveryInProgress();
}
else
{
/*
* We are either a bootstrap process or a standalone backend. Either
* way, start up the XLOG machinery, and register to have it closed
* down at exit.
*/
StartupXLOG();
on_shmem_exit(ShutdownXLOG, 0);
}
/*
* Initialize the relation cache and the system catalog caches. Note that
* no catalog access happens here; we only set up the hashtable structure.
* We must do this before starting a transaction because transaction abort
* would try to touch these hashtables.
*/
RelationCacheInitialize();
InitCatalogCache();
InitPlanCache();
/* Initialize portal manager */
EnablePortalManager();
/* Initialize stats collection --- must happen before first xact */
if (!bootstrap)
pgstat_initialize();
/*
* Load relcache entries for the shared system catalogs. This must create
* at least entries for pg_database and catalogs used for authentication.
*/
RelationCacheInitializePhase2();
/*
* Set up process-exit callback to do pre-shutdown cleanup. This has to
* be after we've initialized all the low-level modules like the buffer
* manager, because during shutdown this has to run before the low-level
* modules start to close down. On the other hand, we want it in place
* before we begin our first transaction --- if we fail during the
* initialization transaction, as is entirely possible, we need the
* AbortTransaction call to clean up.
*/
on_shmem_exit(ShutdownPostgres, 0);
/* The autovacuum launcher is done here */
if (IsAutoVacuumLauncherProcess())
return;
/*
* Start a new transaction here before first access to db, and get a
* snapshot. We don't have a use for the snapshot itself, but we're
* interested in the secondary effect that it sets RecentGlobalXmin. (This
* is critical for anything that reads heap pages, because HOT may decide
* to prune them even if the process doesn't attempt to modify any
* tuples.)
*/
if (!bootstrap)
{
/* statement_timestamp must be set for timeouts to work correctly */
SetCurrentStatementStartTimestamp();
StartTransactionCommand();
/*
* transaction_isolation will have been set to the default by the
* above. If the default is "serializable", and we are in hot
* standby, we will fail if we don't change it to something lower.
* Fortunately, "read committed" is plenty good enough.
*/
XactIsoLevel = XACT_READ_COMMITTED;
(void) GetTransactionSnapshot();
}
/*
* Perform client authentication if necessary, then figure out our
* postgres user ID, and see if we are a superuser.
*
* In standalone mode and in autovacuum worker processes, we use a fixed
* ID, otherwise we figure it out from the authenticated user name.
*/
if (bootstrap || IsAutoVacuumWorkerProcess())
{
InitializeSessionUserIdStandalone();
am_superuser = true;
}
else if (!IsUnderPostmaster)
{
InitializeSessionUserIdStandalone();
am_superuser = true;
if (!ThereIsAtLeastOneRole())
ereport(WARNING,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("no roles are defined in this database system"),
errhint("You should immediately run CREATE USER \"%s\" SUPERUSER;.",
username)));
}
else if (IsBackgroundWorker)
{
if (username == NULL)
{
InitializeSessionUserIdStandalone();
am_superuser = true;
}
else
{
InitializeSessionUserId(username);
am_superuser = superuser();
}
}
else
{
/* normal multiuser case */
Assert(MyProcPort != NULL);
PerformAuthentication(MyProcPort);
InitializeSessionUserId(username);
am_superuser = superuser();
}
/*
* If we're trying to shut down, only superusers can connect, and new
* replication connections are not allowed.
*/
if ((!am_superuser || am_walsender) &&
MyProcPort != NULL &&
MyProcPort->canAcceptConnections == CAC_WAITBACKUP)
{
if (am_walsender)
ereport(FATAL,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("new replication connections are not allowed during database shutdown")));
else
ereport(FATAL,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to connect during database shutdown")));
}
/*
* Binary upgrades only allowed super-user connections
*/
if (IsBinaryUpgrade && !am_superuser)
{
ereport(FATAL,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to connect in binary upgrade mode")));
}
/*
* The last few connections slots are reserved for superusers. Although
* replication connections currently require superuser privileges, we
* don't allow them to consume the reserved slots, which are intended for
* interactive use.
*/
if ((!am_superuser || am_walsender) &&
ReservedBackends > 0 &&
!HaveNFreeProcs(ReservedBackends))
ereport(FATAL,
(errcode(ERRCODE_TOO_MANY_CONNECTIONS),
errmsg("remaining connection slots are reserved for non-replication superuser connections")));
/*
* If walsender, we don't want to connect to any particular database. Just
* finish the backend startup by processing any options from the startup
* packet, and we're done.
*/
if (am_walsender)
{
Assert(!bootstrap);
if (!superuser() && !has_rolreplication(GetUserId()))
ereport(FATAL,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser or replication role to start walsender")));
/* process any options passed in the startup packet */
if (MyProcPort != NULL)
process_startup_options(MyProcPort, am_superuser);
/* Apply PostAuthDelay as soon as we've read all options */
if (PostAuthDelay > 0)
pg_usleep(PostAuthDelay * 1000000L);
/* initialize client encoding */
InitializeClientEncoding();
/* report this backend in the PgBackendStatus array */
pgstat_bestart();
/* close the transaction we started above */
CommitTransactionCommand();
return;
}
/*
* Set up the global variables holding database id and default tablespace.
* But note we won't actually try to touch the database just yet.
*
* We take a shortcut in the bootstrap case, otherwise we have to look up
* the db's entry in pg_database.
*/
if (bootstrap)
{
MyDatabaseId = TemplateDbOid;
MyDatabaseTableSpace = DEFAULTTABLESPACE_OID;
}
else if (in_dbname != NULL)
{
HeapTuple tuple;
Form_pg_database dbform;
tuple = GetDatabaseTuple(in_dbname);
if (!HeapTupleIsValid(tuple))
ereport(FATAL,
(errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database \"%s\" does not exist", in_dbname)));
dbform = (Form_pg_database) GETSTRUCT(tuple);
MyDatabaseId = HeapTupleGetOid(tuple);
MyDatabaseTableSpace = dbform->dattablespace;
/* take database name from the caller, just for paranoia */
strlcpy(dbname, in_dbname, sizeof(dbname));
}
else
{
/* caller specified database by OID */
HeapTuple tuple;
Form_pg_database dbform;
tuple = GetDatabaseTupleByOid(dboid);
if (!HeapTupleIsValid(tuple))
ereport(FATAL,
(errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database %u does not exist", dboid)));
dbform = (Form_pg_database) GETSTRUCT(tuple);
MyDatabaseId = HeapTupleGetOid(tuple);
MyDatabaseTableSpace = dbform->dattablespace;
Assert(MyDatabaseId == dboid);
strlcpy(dbname, NameStr(dbform->datname), sizeof(dbname));
/* pass the database name back to the caller */
if (out_dbname)
strcpy(out_dbname, dbname);
}
/* Now we can mark our PGPROC entry with the database ID */
/* (We assume this is an atomic store so no lock is needed) */
MyProc->databaseId = MyDatabaseId;
/*
* Now, take a writer's lock on the database we are trying to connect to.
* If there is a concurrently running DROP DATABASE on that database, this
* will block us until it finishes (and has committed its update of
* pg_database).
*
* Note that the lock is not held long, only until the end of this startup
* transaction. This is OK since we are already advertising our use of
* the database in the PGPROC array; anyone trying a DROP DATABASE after
* this point will see us there.
*
* Note: use of RowExclusiveLock here is reasonable because we envision
* our session as being a concurrent writer of the database. If we had a
* way of declaring a session as being guaranteed-read-only, we could use
* AccessShareLock for such sessions and thereby not conflict against
* CREATE DATABASE.
*/
if (!bootstrap)
LockSharedObject(DatabaseRelationId, MyDatabaseId, 0,
RowExclusiveLock);
/*
* Recheck pg_database to make sure the target database hasn't gone away.
* If there was a concurrent DROP DATABASE, this ensures we will die
* cleanly without creating a mess.
*/
if (!bootstrap)
{
HeapTuple tuple;
tuple = GetDatabaseTuple(dbname);
if (!HeapTupleIsValid(tuple) ||
MyDatabaseId != HeapTupleGetOid(tuple) ||
MyDatabaseTableSpace != ((Form_pg_database) GETSTRUCT(tuple))->dattablespace)
ereport(FATAL,
(errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database \"%s\" does not exist", dbname),
errdetail("It seems to have just been dropped or renamed.")));
}
/*
* Now we should be able to access the database directory safely. Verify
* it's there and looks reasonable.
*/
fullpath = GetDatabasePath(MyDatabaseId, MyDatabaseTableSpace);
if (!bootstrap)
{
if (access(fullpath, F_OK) == -1)
{
if (errno == ENOENT)
ereport(FATAL,
(errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database \"%s\" does not exist",
dbname),
errdetail("The database subdirectory \"%s\" is missing.",
fullpath)));
else
ereport(FATAL,
(errcode_for_file_access(),
errmsg("could not access directory \"%s\": %m",
fullpath)));
}
ValidatePgVersion(fullpath);
}
SetDatabasePath(fullpath);
/*
* It's now possible to do real access to the system catalogs.
*
* Load relcache entries for the system catalogs. This must create at
* least the minimum set of "nailed-in" cache entries.
*/
RelationCacheInitializePhase3();
/* set up ACL framework (so CheckMyDatabase can check permissions) */
initialize_acl();
/*
* Re-read the pg_database row for our database, check permissions and set
* up database-specific GUC settings. We can't do this until all the
* database-access infrastructure is up. (Also, it wants to know if the
* user is a superuser, so the above stuff has to happen first.)
*/
if (!bootstrap)
CheckMyDatabase(dbname, am_superuser);
/*
* Now process any command-line switches and any additional GUC variable
* settings passed in the startup packet. We couldn't do this before
* because we didn't know if client is a superuser.
*/
if (MyProcPort != NULL)
process_startup_options(MyProcPort, am_superuser);
/* Process pg_db_role_setting options */
process_settings(MyDatabaseId, GetSessionUserId());
/* Apply PostAuthDelay as soon as we've read all options */
if (PostAuthDelay > 0)
pg_usleep(PostAuthDelay * 1000000L);
/*
* Initialize various default states that can't be set up until we've
* selected the active user and gotten the right GUC settings.
*/
/* set default namespace search path */
InitializeSearchPath();
/* initialize client encoding */
InitializeClientEncoding();
/* report this backend in the PgBackendStatus array */
if (!bootstrap)
pgstat_bestart();
/* close the transaction we started above */
if (!bootstrap)
CommitTransactionCommand();
}
| bool InLocalUserIdChange | ( | void | ) |
Definition at line 347 of file miscinit.c.
References SECURITY_LOCAL_USERID_CHANGE, and SecurityRestrictionContext.
Referenced by GetUserIdAndContext(), and set_config_option().
{
return (SecurityRestrictionContext & SECURITY_LOCAL_USERID_CHANGE) != 0;
}
| bool InSecurityRestrictedOperation | ( | void | ) |
Definition at line 356 of file miscinit.c.
References SECURITY_RESTRICTED_OPERATION, and SecurityRestrictionContext.
Referenced by CheckRestrictedOperation(), DefineRelation(), set_config_option(), and SetUserIdAndContext().
{
return (SecurityRestrictionContext & SECURITY_RESTRICTED_OPERATION) != 0;
}
| char* make_absolute_path | ( | const char * | path | ) |
Definition at line 131 of file miscinit.c.
References buf, canonicalize_path(), elog, ereport, errcode(), errmsg(), FATAL, free, is_absolute_path, malloc, and NULL.
Referenced by regression_main(), SelectConfigFiles(), and SetDataDir().
{
char *new;
/* Returning null for null input is convenient for some callers */
if (path == NULL)
return NULL;
if (!is_absolute_path(path))
{
char *buf;
size_t buflen;
buflen = MAXPGPATH;
for (;;)
{
buf = malloc(buflen);
if (!buf)
ereport(FATAL,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
if (getcwd(buf, buflen))
break;
else if (errno == ERANGE)
{
free(buf);
buflen *= 2;
continue;
}
else
{
free(buf);
elog(FATAL, "could not get current working directory: %m");
}
}
new = malloc(strlen(buf) + strlen(path) + 2);
if (!new)
ereport(FATAL,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
sprintf(new, "%s/%s", buf, path);
free(buf);
}
else
{
new = strdup(path);
if (!new)
ereport(FATAL,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
}
/* Make sure punctuation is canonical, too */
canonicalize_path(new);
return new;
}
| void pg_bindtextdomain | ( | const char * | domain | ) |
Definition at line 1329 of file miscinit.c.
References get_locale_path(), my_exec_path, and pg_bind_textdomain_codeset().
Referenced by _PG_init().
{
#ifdef ENABLE_NLS
if (my_exec_path[0] != '\0')
{
char locale_path[MAXPGPATH];
get_locale_path(my_exec_path, locale_path);
bindtextdomain(domain, locale_path);
pg_bind_textdomain_codeset(domain);
}
#endif
}
| void pg_split_opts | ( | char ** | argv, | |
| int * | argcp, | |||
| char * | optstr | |||
| ) |
Definition at line 409 of file postinit.c.
Referenced by BackendRun(), and process_startup_options().
{
while (*optstr)
{
while (isspace((unsigned char) *optstr))
optstr++;
if (*optstr == '\0')
break;
argv[(*argcp)++] = optstr;
while (*optstr && !isspace((unsigned char) *optstr))
optstr++;
if (*optstr)
*optstr++ = '\0';
}
}
| void PreventCommandDuringRecovery | ( | const char * | cmdname | ) |
Definition at line 282 of file utility.c.
References ereport, errcode(), errmsg(), ERROR, and RecoveryInProgress().
Referenced by LockTableCommand(), pg_notify(), standard_ProcessUtility(), and txid_current().
{
if (RecoveryInProgress())
ereport(ERROR,
(errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
/* translator: %s is name of a SQL command, eg CREATE */
errmsg("cannot execute %s during recovery",
cmdname)));
}
| void PreventCommandIfReadOnly | ( | const char * | cmdname | ) |
Definition at line 263 of file utility.c.
References ereport, errcode(), errmsg(), ERROR, and XactReadOnly.
Referenced by check_xact_readonly(), do_setval(), DoCopy(), ExecCheckXactReadOnly(), and nextval_internal().
{
if (XactReadOnly)
ereport(ERROR,
(errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
/* translator: %s is name of a SQL command, eg CREATE */
errmsg("cannot execute %s in a read-only transaction",
cmdname)));
}
| void process_local_preload_libraries | ( | void | ) |
Definition at line 1321 of file miscinit.c.
References load_libraries(), and local_preload_libraries_string.
Referenced by PostgresMain().
{
load_libraries(local_preload_libraries_string,
"local_preload_libraries",
true);
}
| void process_shared_preload_libraries | ( | void | ) |
Definition at line 1308 of file miscinit.c.
References load_libraries(), process_shared_preload_libraries_in_progress, and shared_preload_libraries_string.
Referenced by PostmasterMain().
{
process_shared_preload_libraries_in_progress = true;
load_libraries(shared_preload_libraries_string,
"shared_preload_libraries",
false);
process_shared_preload_libraries_in_progress = false;
}
| void ProcessInterrupts | ( | void | ) |
Definition at line 112 of file ipc_test.c.
References Assert, ClientAuthInProgress, ClientConnectionLost, CritSectionCount, DestRemote, DisableCatchupInterrupt(), DisableNotifyInterrupt(), DoingCommandRead, ereport, errcode(), errdetail_recovery_conflict(), errhint(), errmsg(), ERROR, FATAL, get_timeout_indicator(), ImmediateInterruptOK, InterruptHoldoffCount, InterruptPending, IsAutoVacuumWorkerProcess(), LOCK_TIMEOUT, pgstat_report_recovery_conflict(), ProcDiePending, PROCSIG_RECOVERY_CONFLICT_DATABASE, QueryCancelPending, RecoveryConflictPending, RecoveryConflictReason, RecoveryConflictRetryable, STATEMENT_TIMEOUT, and whereToSendOutput.
Referenced by die(), RecoveryConflictInterrupt(), and StatementCancelHandler().
{
}
| void restore_stack_base | ( | pg_stack_base_t | base | ) |
Definition at line 3032 of file postgres.c.
References stack_base_ptr.
{
#if defined(__ia64__) || defined(__ia64)
stack_base_ptr = base.stack_base_ptr;
register_stack_base_ptr = base.register_stack_base_ptr;
#else
stack_base_ptr = base;
#endif
}
| pg_stack_base_t set_stack_base | ( | void | ) |
Definition at line 3001 of file postgres.c.
References stack_base_ptr.
Referenced by PostmasterMain().
{
char stack_base;
pg_stack_base_t old;
#if defined(__ia64__) || defined(__ia64)
old.stack_base_ptr = stack_base_ptr;
old.register_stack_base_ptr = register_stack_base_ptr;
#else
old = stack_base_ptr;
#endif
/* Set up reference point for stack depth checking */
stack_base_ptr = &stack_base;
#if defined(__ia64__) || defined(__ia64)
register_stack_base_ptr = ia64_get_bsp();
#endif
return old;
}
Definition at line 576 of file miscinit.c.
References OidIsValid, PGC_INTERNAL, PGC_S_OVERRIDE, SessionUserId, SessionUserIsSuperuser, SetConfigOption(), SetOuterUserId(), and SetRoleIsActive.
Referenced by assign_role().
{
/*
* Get correct info if it's SET ROLE NONE
*
* If SessionUserId hasn't been set yet, just do nothing --- the eventual
* SetSessionUserId call will fix everything. This is needed since we
* will get called during GUC initialization.
*/
if (!OidIsValid(roleid))
{
if (!OidIsValid(SessionUserId))
return;
roleid = SessionUserId;
is_superuser = SessionUserIsSuperuser;
SetRoleIsActive = false;
}
else
SetRoleIsActive = true;
SetOuterUserId(roleid);
SetConfigOption("is_superuser",
is_superuser ? "on" : "off",
PGC_INTERNAL, PGC_S_OVERRIDE);
}
| void SetDatabasePath | ( | const char * | path | ) |
Definition at line 76 of file miscinit.c.
References Assert, DatabasePath, MemoryContextStrdup(), and TopMemoryContext.
Referenced by InitPostgres().
{
/* This should happen only once per process */
Assert(!DatabasePath);
DatabasePath = MemoryContextStrdup(TopMemoryContext, path);
}
| void SetDataDir | ( | const char * | dir | ) |
Definition at line 88 of file miscinit.c.
References AssertArg, DataDir, free, and make_absolute_path().
Referenced by SelectConfigFiles().
Definition at line 530 of file miscinit.c.
References AssertState, AuthenticatedUserId, AuthenticatedUserIsSuperuser, ereport, errcode(), errmsg(), ERROR, OidIsValid, PGC_INTERNAL, PGC_S_OVERRIDE, SetConfigOption(), and SetSessionUserId().
Referenced by assign_session_authorization().
{
/* Must have authenticated already, else can't make permission check */
AssertState(OidIsValid(AuthenticatedUserId));
if (userid != AuthenticatedUserId &&
!AuthenticatedUserIsSuperuser)
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to set session authorization")));
SetSessionUserId(userid, is_superuser);
SetConfigOption("is_superuser",
is_superuser ? "on" : "off",
PGC_INTERNAL, PGC_S_OVERRIDE);
}
Definition at line 376 of file miscinit.c.
References CurrentUserId, ereport, errcode(), errmsg(), ERROR, InSecurityRestrictedOperation(), and SecurityRestrictionContext.
{
/* We throw the same error SET ROLE would. */
if (InSecurityRestrictedOperation())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("cannot set parameter \"%s\" within security-restricted operation",
"role")));
CurrentUserId = userid;
if (sec_def_context)
SecurityRestrictionContext |= SECURITY_LOCAL_USERID_CHANGE;
else
SecurityRestrictionContext &= ~SECURITY_LOCAL_USERID_CHANGE;
}
| void SetUserIdAndSecContext | ( | Oid | userid, | |
| int | sec_context | |||
| ) |
Definition at line 336 of file miscinit.c.
References CurrentUserId, and SecurityRestrictionContext.
Referenced by AbortSubTransaction(), AbortTransaction(), CreateSchemaCommand(), do_analyze_rel(), fmgr_security_definer(), index_build(), ri_PerformCheck(), ri_PlanCheck(), vacuum_rel(), and validate_index().
{
CurrentUserId = userid;
SecurityRestrictionContext = sec_context;
}
| bool superuser | ( | void | ) |
Definition at line 47 of file superuser.c.
References GetUserId(), and superuser_arg().
Referenced by AddRoleMems(), AlterForeignDataWrapper(), AlterForeignDataWrapperOwner_internal(), AlterForeignServerOwner_internal(), AlterFunction(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterOpFamily(), AlterRole(), AlterRoleSet(), AlterTypeOwner(), ATExecChangeOwner(), bt_metap(), bt_page_items(), bt_page_stats(), check_conn_params(), check_encoding_locale_matches(), connect_pg_server(), CreateCast(), CreateEventTrigger(), CreateForeignDataWrapper(), CreateFunction(), CreateProceduralLanguage(), CreateRole(), CreateTableSpace(), dblink_connstr_check(), dblink_security_check(), DefineAggregate(), DefineOpClass(), DefineOpFamily(), DefineTSParser(), DefineTSTemplate(), DefineType(), DelRoleMems(), do_pg_start_backup(), do_pg_stop_backup(), DoCopy(), DropRole(), dummy_object_relabel(), EnableDisableTrigger(), ExecSetVariableStmt(), execute_extension_script(), ExecuteDoStmt(), file_fdw_validator(), fmgr_security_definer(), fsm_page_contents(), get_raw_page_internal(), GetConfigOption(), GetConfigOptionByName(), GetConfigOptionByNum(), GetConfigOptionResetString(), GUCArrayReset(), have_createdb_privilege(), heap_page_items(), InitPostgres(), lo_export(), lo_import_internal(), main(), page_header(), pg_create_restore_point(), pg_is_xlog_replay_paused(), pg_logdir_ls(), pg_ls_dir(), pg_read_binary_file(), pg_read_binary_file_all(), pg_read_file(), pg_read_file_all(), pg_reload_conf(), pg_relpages(), pg_rotate_logfile(), pg_signal_backend(), pg_stat_file(), pg_stat_get_activity(), pg_stat_get_backend_activity(), pg_stat_get_backend_activity_start(), pg_stat_get_backend_client_addr(), pg_stat_get_backend_client_port(), pg_stat_get_backend_start(), pg_stat_get_backend_waiting(), pg_stat_get_backend_xact_start(), pg_stat_get_wal_senders(), pg_stat_statements(), pg_switch_xlog(), pg_xlog_replay_pause(), pg_xlog_replay_resume(), pgstat_get_backend_current_activity(), pgstat_reset_counters(), pgstat_reset_shared_counters(), pgstat_reset_single_counter(), pgstatginindex(), pgstatindex(), pgstattuple(), pgstattuplebyid(), ProcedureCreate(), RenameRole(), requireSuperuser(), sepgsql_restorecon(), set_config_by_name(), SetPGVariable(), ShowAllGUCConfig(), standard_ProcessUtility(), and validate_option_array_item().
{
return superuser_arg(GetUserId());
}
Definition at line 57 of file superuser.c.
References AUTHOID, BOOTSTRAP_SUPERUSERID, CacheRegisterSyscacheCallback(), GETSTRUCT, HeapTupleIsValid, IsUnderPostmaster, last_roleid, last_roleid_is_super, ObjectIdGetDatum, OidIsValid, ReleaseSysCache(), roleid_callback_registered, RoleidCallback(), and SearchSysCache1.
Referenced by AddRoleMems(), AlterEventTriggerOwner_internal(), AlterForeignDataWrapperOwner_internal(), check_object_ownership(), DelRoleMems(), has_createrole_privilege(), has_privs_of_role(), is_admin_of_role(), is_member_of_role(), LockGXact(), pg_class_aclmask(), pg_class_ownercheck(), pg_collation_ownercheck(), pg_conversion_ownercheck(), pg_database_aclmask(), pg_database_ownercheck(), pg_event_trigger_ownercheck(), pg_extension_ownercheck(), pg_foreign_data_wrapper_aclmask(), pg_foreign_data_wrapper_ownercheck(), pg_foreign_server_aclmask(), pg_foreign_server_ownercheck(), pg_language_aclmask(), pg_language_ownercheck(), pg_largeobject_aclmask_snapshot(), pg_largeobject_ownercheck(), pg_namespace_aclmask(), pg_namespace_ownercheck(), pg_opclass_ownercheck(), pg_oper_ownercheck(), pg_opfamily_ownercheck(), pg_proc_aclmask(), pg_proc_ownercheck(), pg_tablespace_aclmask(), pg_tablespace_ownercheck(), pg_ts_config_ownercheck(), pg_ts_dict_ownercheck(), pg_type_aclmask(), pg_type_ownercheck(), pltcl_init_load_unknown(), select_best_grantor(), and superuser().
{
bool result;
HeapTuple rtup;
/* Quick out for cache hit */
if (OidIsValid(last_roleid) && last_roleid == roleid)
return last_roleid_is_super;
/* Special escape path in case you deleted all your users. */
if (!IsUnderPostmaster && roleid == BOOTSTRAP_SUPERUSERID)
return true;
/* OK, look up the information in pg_authid */
rtup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
if (HeapTupleIsValid(rtup))
{
result = ((Form_pg_authid) GETSTRUCT(rtup))->rolsuper;
ReleaseSysCache(rtup);
}
else
{
/* Report "not superuser" for invalid roleids */
result = false;
}
/* If first time through, set up callback for cache flushes */
if (!roleid_callback_registered)
{
CacheRegisterSyscacheCallback(AUTHOID,
RoleidCallback,
(Datum) 0);
roleid_callback_registered = true;
}
/* Cache the result for next time */
last_roleid = roleid;
last_roleid_is_super = result;
return result;
}
| void TouchSocketLockFiles | ( | void | ) |
Definition at line 999 of file miscinit.c.
References close, DIRECTORY_LOCK_FILE, lfirst, NULL, PG_BINARY, and read.
Referenced by ServerLoop().
{
ListCell *l;
foreach(l, lock_files)
{
char *socketLockFile = (char *) lfirst(l);
/* No need to touch the data directory lock file, we trust */
if (strcmp(socketLockFile, DIRECTORY_LOCK_FILE) == 0)
continue;
/*
* utime() is POSIX standard, utimes() is a common alternative; if we
* have neither, fall back to actually reading the file (which only
* sets the access time not mod time, but that should be enough in
* most cases). In all paths, we ignore errors.
*/
#ifdef HAVE_UTIME
utime(socketLockFile, NULL);
#else /* !HAVE_UTIME */
#ifdef HAVE_UTIMES
utimes(socketLockFile, NULL);
#else /* !HAVE_UTIMES */
int fd;
char buffer[1];
fd = open(socketLockFile, O_RDONLY | PG_BINARY, 0);
if (fd >= 0)
{
read(fd, buffer, sizeof(buffer));
close(fd);
}
#endif /* HAVE_UTIMES */
#endif /* HAVE_UTIME */
}
}
| int trace_recovery | ( | int | trace_level | ) |
Definition at line 3119 of file elog.c.
References LOG, and trace_recovery_messages.
Referenced by KnownAssignedXidsRemove(), KnownAssignedXidsRemovePreceding(), LogCurrentRunningXacts(), ProcArrayApplyRecoveryInfo(), ProcessCommittedInvalidationMessages(), RecordKnownAssignedTransactionIds(), RecoveryRestartPoint(), StandbyAcquireAccessExclusiveLock(), StandbyReleaseAllLocks(), StandbyReleaseLocks(), and StandbyReleaseOldLocks().
{
if (trace_level < LOG &&
trace_level >= trace_recovery_messages)
return LOG;
return trace_level;
}
| void ValidatePgVersion | ( | const char * | path | ) |
Definition at line 1162 of file miscinit.c.
References AllocateFile(), ereport, errcode(), errcode_for_file_access(), errdetail(), errhint(), errmsg(), FATAL, FreeFile(), NULL, and snprintf().
Referenced by AuxiliaryProcessMain(), checkDataDir(), InitPostgres(), and PostgresMain().
{
char full_path[MAXPGPATH];
FILE *file;
int ret;
long file_major,
file_minor;
long my_major = 0,
my_minor = 0;
char *endptr;
const char *version_string = PG_VERSION;
my_major = strtol(version_string, &endptr, 10);
if (*endptr == '.')
my_minor = strtol(endptr + 1, NULL, 10);
snprintf(full_path, sizeof(full_path), "%s/PG_VERSION", path);
file = AllocateFile(full_path, "r");
if (!file)
{
if (errno == ENOENT)
ereport(FATAL,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("\"%s\" is not a valid data directory",
path),
errdetail("File \"%s\" is missing.", full_path)));
else
ereport(FATAL,
(errcode_for_file_access(),
errmsg("could not open file \"%s\": %m", full_path)));
}
ret = fscanf(file, "%ld.%ld", &file_major, &file_minor);
if (ret != 2)
ereport(FATAL,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("\"%s\" is not a valid data directory",
path),
errdetail("File \"%s\" does not contain valid data.",
full_path),
errhint("You might need to initdb.")));
FreeFile(file);
if (my_major != file_major || my_minor != file_minor)
ereport(FATAL,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("database files are incompatible with server"),
errdetail("The data directory was initialized by PostgreSQL version %ld.%ld, "
"which is not compatible with this version %s.",
file_major, file_minor, version_string)));
}
Definition at line 100 of file globals.c.
Referenced by ATAddForeignKeyConstraint(), ATExecAddIndexConstraint(), ATSimplePermissions(), CheckRelationOwnership(), CreateSchemaCommand(), CreateTableSpace(), CreateTrigger(), DefineIndex(), DefineQueryRewrite(), DefineRelation(), perform_relmap_update(), pg_class_aclmask(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForDropRelation(), RangeVarCallbackForRenameRule(), RangeVarCallbackForRenameTrigger(), RemoveTriggerById(), renameatt_check(), RenameSchema(), RenameTableSpace(), and truncate_check_rel().
| volatile bool ClientConnectionLost |
Definition at line 31 of file globals.c.
Referenced by internal_flush(), and ProcessInterrupts().
| PGDLLIMPORT volatile uint32 CritSectionCount |
Definition at line 46 of file ipc_test.c.
Referenced by die(), errfinish(), errstart(), log_newpage_buffer(), proc_exit_prepare(), ProcessInterrupts(), RecoveryConflictInterrupt(), StatementCancelHandler(), and XLogWrite().
| int CTimeZone |
Definition at line 97 of file globals.c.
Referenced by abstime2tm(), assign_timezone(), check_timezone(), DetermineTimeZoneOffset(), show_timezone(), and timestamp2tm().
| char* DatabasePath |
Definition at line 71 of file globals.c.
Referenced by load_relcache_init_file(), load_relmap_file(), perform_relmap_update(), ProcessCommittedInvalidationMessages(), RelationCacheInitFilePreInvalidate(), RelationMapFinishBootstrap(), SetDatabasePath(), and write_relcache_init_file().
| PGDLLIMPORT char* DataDir |
Definition at line 54 of file ipc_test.c.
Referenced by AuxiliaryProcessMain(), ChangeToDataDir(), checkDataDir(), convert_and_check_filename(), CreateDataDirLockFile(), CreateLockFile(), GetSharedMemName(), main(), PGSharedMemoryCreate(), PGSharedMemoryIsInUse(), PostgresMain(), SelectConfigFiles(), SetDataDir(), and StartupXLOG().
| int DateOrder |
Definition at line 94 of file globals.c.
Referenced by assign_datestyle(), check_datestyle(), DecodeNumber(), EncodeDateOnly(), and EncodeDateTime().
| int DateStyle |
Definition at line 93 of file globals.c.
Referenced by abstimeout(), assign_datestyle(), check_datestyle(), date_out(), PGTYPESdate_to_asc(), PGTYPEStimestamp_to_asc(), set_transmission_modes(), time_out(), timestamp_out(), timestamptz_out(), and timetz_out().
Definition at line 99 of file globals.c.
Referenced by copydir(), get_sync_bit(), mdsync(), pg_fdatasync(), pg_flush_data(), pg_fsync_no_writethrough(), pg_fsync_writethrough(), and XLogFlush().
Definition at line 91 of file globals.c.
Referenced by BackgroundWriterMain(), CheckpointerMain(), and errstart().
Definition at line 96 of file globals.c.
Referenced by abstime2tm(), assign_timezone(), check_timezone(), DetermineTimeZoneOffset(), show_timezone(), and timestamp2tm().
Definition at line 67 of file miscinit.c.
Referenced by AuxiliaryProcessMain(), get_relation_info(), systable_beginscan(), and systable_beginscan_ordered().
| volatile bool ImmediateInterruptOK |
Definition at line 44 of file ipc_test.c.
Referenced by client_read_ended(), ClientAuthentication(), die(), errfinish(), HandleCatchupInterrupt(), HandleNotifyInterrupt(), md5_crypt_verify(), PGSemaphoreLock(), prepare_for_client_read(), proc_exit_prepare(), ProcessInterrupts(), RecoveryConflictInterrupt(), StatementCancelHandler(), and WalSndLoop().
| PGDLLIMPORT volatile uint32 InterruptHoldoffCount |
Definition at line 45 of file ipc_test.c.
Referenced by die(), errfinish(), proc_exit_prepare(), ProcessInterrupts(), RecoveryConflictInterrupt(), and StatementCancelHandler().
| PGDLLIMPORT volatile bool InterruptPending |
Definition at line 41 of file ipc_test.c.
Referenced by die(), internal_flush(), proc_exit_prepare(), ProcessInterrupts(), RecoveryConflictInterrupt(), StatementCancelHandler(), and vacuum_delay_point().
| int IntervalStyle |
Definition at line 95 of file globals.c.
Referenced by DecodeInterval(), interval_out(), PGTYPESinterval_to_asc(), reltimeout(), and set_transmission_modes().
Definition at line 89 of file globals.c.
Referenced by do_start_bgworker(), InitializeSessionUserIdStandalone(), InitPostgres(), InitProcess(), and ProcKill().
Definition at line 88 of file globals.c.
Referenced by AddEnumLabel(), AssignTypeArrayOid(), create_toast_table(), CreateRole(), heap_create_with_catalog(), index_create(), InitPostgres(), PostmasterMain(), process_postgres_switches(), reaper(), ServerLoop(), TypeCreate(), and TypeShellMake().
Definition at line 86 of file globals.c.
Referenced by errstart(), GetNewObjectId(), pg_re_throw(), PostmasterMain(), and RequestCheckpoint().
| PGDLLIMPORT bool IsUnderPostmaster |
Definition at line 48 of file ipc_test.c.
Referenced by _PG_init(), AutoVacLauncherMain(), AutoVacuumShmemInit(), AutoVacWorkerMain(), AuxiliaryProcessMain(), BackendStartup(), bootstrap_signals(), BootstrapModeMain(), BTreeShmemInit(), CheckMyDatabase(), CheckRecoveryConsistency(), CreateSharedMemoryAndSemaphores(), DebugFileOpen(), do_start_bgworker(), EventTriggerDDLCommandEnd(), EventTriggerDDLCommandStart(), EventTriggerSQLDrop(), ForgetDatabaseFsyncRequests(), ForgetRelationFsyncRequests(), ForwardFsyncRequest(), GetNewMultiXactId(), GetNewTransactionId(), HandleStartupProcInterrupts(), heap_create_with_catalog(), init_ps_display(), InitCommunication(), InitializeSessionUserId(), InitializeSessionUserIdStandalone(), InitPostgres(), InitProcess(), load_libraries(), LWLockAcquire(), mdinit(), MultiXactShmemInit(), PgArchiverMain(), PGSemaphoreCreate(), PGSharedMemoryReAttach(), pgss_shmem_startup(), PgstatCollectorMain(), PostgresMain(), process_postgres_switches(), process_settings(), ProcKill(), register_unlink(), RegisterBackgroundWorker(), RequestAddinLWLocks(), RequestAddinShmemSpace(), SendPostmasterSignal(), set_config_option(), set_config_sourcefile(), set_ps_display(), SetMultiXactIdLimit(), SetTransactionIdLimit(), ShmemInitStruct(), SimpleLruInit(), StartChildProcess(), StartupXLOG(), superuser_arg(), SyncScanShmemInit(), SysLoggerMain(), TwoPhaseShmemInit(), verify_dictoptions(), XLogArchiveNotify(), and XLogWrite().
Definition at line 1226 of file miscinit.c.
Referenced by process_local_preload_libraries().
| PGDLLIMPORT int maintenance_work_mem |
Definition at line 102 of file globals.c.
Referenced by _bt_spoolinit(), _h_spoolinit(), copy_heap_data(), ginBuildCallback(), ginInsertCleanup(), gistInitBuffering(), lazy_space_alloc(), plan_cluster_use_sort(), RI_Initial_Check(), and validate_index().
| int MaxBackends |
Definition at line 51 of file ipc_test.c.
Referenced by asyncQueueAdvanceTail(), asyncQueueFillWarning(), AsyncShmemInit(), AsyncShmemSize(), AuxiliaryProcessMain(), BackendStatusShmemSize(), BTreeShmemInit(), BTreeShmemSize(), CreateSharedBackendStatus(), CreateSharedInvalidationState(), DeadLockCheckRecurse(), ExpandConstraints(), FindLockCycleRecurse(), GetLockConflicts(), GetLockStatusData(), GetSerializableTransactionSnapshotInt(), InitDeadLockChecking(), InitializeMaxBackends(), InitPostgres(), InitPredicateLocks(), InitProcGlobal(), NumLWLocks(), pgstat_get_backend_current_activity(), pgstat_get_crashed_backend_activity(), pgstat_initialize(), pgstat_read_current_status(), predicatelock_twophase_recover(), PredicateLockShmemSize(), ProcGlobalSemas(), ProcGlobalShmemSize(), SignalBackends(), SInvalShmemSize(), StreamServerPort(), TestConfiguration(), and TwoPhaseShmemInit().
| int MaxConnections |
Definition at line 111 of file globals.c.
Referenced by BootStrapXLOG(), check_autovacuum_max_workers(), CheckRequiredParameterValues(), InitializeMaxBackends(), InitProcGlobal(), MaxLivePostmasterChildren(), PostmasterMain(), RegisterBackgroundWorker(), and XLogReportParameters().
Definition at line 51 of file miscinit.c.
| PGDLLIMPORT char my_exec_path[] |
Definition at line 52 of file globals.c.
Referenced by adjust_data_dir(), AuxiliaryProcessMain(), get_extension_control_directory(), get_extension_control_filename(), get_extension_script_directory(), get_tsearch_config_filename(), getInstallationPaths(), main(), ParseTzFile(), pg_bindtextdomain(), pg_dlopen(), pg_TZDIR(), PostgresMain(), PostmasterMain(), process_psqlrc(), and set_pglocale_pgservice().
Definition at line 70 of file bootstrap.c.
Referenced by AuxiliaryProcessMain().
| long MyCancelKey |
Definition at line 39 of file globals.c.
Referenced by assign_backendlist_entry(), BackendStartup(), PostgresMain(), and StartAutovacuumWorker().
| PGDLLIMPORT Oid MyDatabaseId |
Definition at line 63 of file globals.c.
Referenced by AfterTriggerSetState(), AlterSchemaOwner_internal(), analyze_rel(), asyncQueueNotificationToEntry(), asyncQueueProcessPageEntries(), backend_read_statsfile(), CacheInvalidateCatalog(), CacheInvalidateHeapTuple(), CacheInvalidateRelcache(), CacheInvalidateRelcacheByTuple(), CheckMyDatabase(), checkSharedDependencies(), classIdGetDbId(), CreateProceduralLanguage(), CreateSchemaCommand(), current_database(), database_to_xml_internal(), DeconstructQualifiedName(), do_analyze_rel(), do_autovacuum(), dropdb(), exec_object_restorecon(), ExpandColumnRefStar(), ExportSnapshot(), GetCurrentVirtualXIDs(), GetNewRelFileNode(), GetOldestXmin(), ImportSnapshot(), InitPostgres(), InitTempTableNamespace(), lazy_vacuum_rel(), LocalExecuteInvalidationMessage(), LockDatabaseObject(), LockGXact(), map_sql_catalog_to_xmlschema_types(), map_sql_schema_to_xmlschema_types(), map_sql_table_to_xmlschema(), map_sql_type_to_xml_name(), movedb(), perform_relmap_update(), pg_namespace_aclmask(), pg_relation_filepath(), pgss_store(), pgstat_beshutdown_hook(), pgstat_bestart(), pgstat_fetch_stat_funcentry(), pgstat_fetch_stat_tabentry(), pgstat_report_analyze(), pgstat_report_deadlock(), pgstat_report_recovery_conflict(), pgstat_report_stat(), pgstat_report_tempfile(), pgstat_report_vacuum(), pgstat_reset_counters(), pgstat_reset_single_counter(), pgstat_send_funcstats(), pgstat_vacuum_stat(), PrepareToInvalidateCacheTuple(), PrepareTransaction(), ProcArrayInstallImportedXmin(), RangeVarGetAndCheckCreationNamespace(), RangeVarGetCreationNamespace(), RangeVarGetRelidExtended(), RecordTransactionCommit(), ReindexDatabase(), RelationInitLockInfo(), RelationInitPhysicalAddr(), RelationMapFinishBootstrap(), RenameDatabase(), RenameSchema(), ScanPgRelation(), sepgsql_schema_post_create(), SetLocktagRelationOid(), shdepDropOwned(), shdepReassignOwned(), table_recheck_autovac(), transformColumnRef(), UnlockDatabaseObject(), vac_truncate_clog(), vac_update_datfrozenxid(), and vacuum_rel().
| PGDLLIMPORT Oid MyDatabaseTableSpace |
Definition at line 65 of file globals.c.
Referenced by ATExecSetTableSpace(), calculate_tablespace_size(), check_temp_tablespaces(), DefineIndex(), DefineRelation(), get_tablespace(), GetDefaultTablespace(), GetNewRelFileNode(), heap_create(), InitPostgres(), OpenTemporaryFile(), perform_relmap_update(), pg_relation_filepath(), pg_tablespace_location(), PrepareTempTablespaces(), RecordTransactionCommit(), RelationInitPhysicalAddr(), and RelationMapFinishBootstrap().
| int MyPMChildSlot |
Definition at line 40 of file globals.c.
Referenced by assign_backendlist_entry(), BackendStartup(), MarkPostmasterChildActive(), MarkPostmasterChildInactive(), MarkPostmasterChildWalSender(), StartAutovacuumWorker(), and StartOneBackgroundWorker().
| PGDLLIMPORT int MyProcPid |
Definition at line 36 of file globals.c.
Referenced by Async_Listen(), Async_Unlisten(), Async_UnlistenAll(), asyncQueueNotificationToEntry(), asyncQueueReadAllNotifications(), asyncQueueUnregister(), AutoVacLauncherMain(), AutoVacWorkerMain(), AuxiliaryProcessMain(), BackendRun(), BackendStartup(), CheckpointerMain(), CleanupProcSignalState(), DisownLatch(), do_start_bgworker(), Exec_ListenPreCommit(), Exec_UnlistenAllCommit(), Exec_UnlistenCommit(), GetSerializableTransactionSnapshotInt(), InitAuxiliaryProcess(), InitLatch(), InitPostmasterDeathWatchHandle(), InitProcess(), InitWalSenderSlot(), LockBufferForCleanup(), LockTimeoutHandler(), log_line_prefix(), LWLockAcquire(), LWLockAcquireOrWait(), OpenTemporaryFileInTablespace(), OwnLatch(), pg_backend_pid(), PgArchiverMain(), pgstat_bestart(), PgstatCollectorMain(), PostgresMain(), PostmasterMain(), ProcSignalInit(), ProcSleep(), PublishStartupProcessInformation(), ResetLatch(), set_ps_display(), SetLatch(), SharedInvalBackendInit(), SignalBackends(), StatementTimeoutHandler(), SysLoggerMain(), UnlockBuffers(), WaitLatchOrSocket(), WalRcvDie(), WalReceiverMain(), WalSndLastCycleHandler(), write_csvlog(), write_pipe_chunks(), and write_relcache_init_file().
| PGDLLIMPORT struct Port* MyProcPort |
Definition at line 38 of file globals.c.
Referenced by assign_tcp_keepalives_count(), assign_tcp_keepalives_idle(), assign_tcp_keepalives_interval(), BackendInitialize(), inet_client_addr(), inet_client_port(), inet_server_addr(), inet_server_port(), InitPostgres(), internal_flush(), log_disconnections(), log_line_prefix(), pgstat_bestart(), pq_close(), pq_getbyte_if_available(), pq_recvbuf(), pq_set_nonblocking(), show_tcp_keepalives_count(), show_tcp_keepalives_idle(), show_tcp_keepalives_interval(), ssl_cipher(), ssl_client_cert_present(), ssl_client_dn(), ssl_client_dn_field(), ssl_client_serial(), ssl_is_used(), ssl_issuer_dn(), ssl_issuer_field(), ssl_version(), WalSndLoop(), and write_csvlog().
| PGDLLIMPORT pg_time_t MyStartTime |
Definition at line 37 of file globals.c.
Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), AuxiliaryProcessMain(), BackendInitialize(), BackendStartup(), CreateLockFile(), do_start_bgworker(), log_line_prefix(), PgArchiverMain(), PgstatCollectorMain(), PostgresMain(), PostmasterMain(), setup_formatted_start_time(), SysLoggerMain(), and write_csvlog().
| PGDLLIMPORT int NBuffers |
Definition at line 52 of file ipc_test.c.
| char OutputFileName[] |
Definition at line 50 of file globals.c.
Referenced by AuxiliaryProcessMain(), DebugFileOpen(), and process_postgres_switches().
| char pkglib_path[] |
Definition at line 53 of file globals.c.
Referenced by getInstallationPaths(), PostgresMain(), and substitute_libpath_macro().
| pid_t PostmasterPid |
Definition at line 73 of file globals.c.
Referenced by InitPostmasterDeathWatchHandle(), pg_reload_conf(), PostmasterMain(), and SendPostmasterSignal().
| volatile bool ProcDiePending |
Definition at line 43 of file ipc_test.c.
Referenced by die(), proc_exit_prepare(), ProcessInterrupts(), RecoveryConflictInterrupt(), and SyncRepWaitForLSN().
| PGDLLIMPORT bool process_shared_preload_libraries_in_progress |
Definition at line 1229 of file miscinit.c.
Referenced by _PG_init(), init_custom_variable(), load_libraries(), process_shared_preload_libraries(), and RegisterBackgroundWorker().
| volatile bool QueryCancelPending |
Definition at line 42 of file ipc_test.c.
Referenced by AutoVacLauncherMain(), do_autovacuum(), PostgresMain(), proc_exit_prepare(), ProcessInterrupts(), RecoveryConflictInterrupt(), StatementCancelHandler(), and SyncRepWaitForLSN().
Definition at line 1225 of file miscinit.c.
Referenced by process_shared_preload_libraries().
Definition at line 420 of file guc.c.
Referenced by StartupXLOG(), and trace_recovery().
Definition at line 125 of file globals.c.
Referenced by MarkBufferDirty(), MarkBufferDirtyHint(), ReadBuffer_common(), vacuum(), and vacuum_delay_point().
Definition at line 124 of file globals.c.
Referenced by MarkBufferDirty(), MarkBufferDirtyHint(), ReadBuffer_common(), vacuum(), and vacuum_delay_point().
| int VacuumCostDelay |
Definition at line 118 of file globals.c.
Referenced by autovac_balance_cost(), AutoVacuumUpdateDelay(), do_autovacuum(), table_recheck_autovac(), vacuum(), and vacuum_delay_point().
| int VacuumCostLimit |
Definition at line 117 of file globals.c.
Referenced by autovac_balance_cost(), AutoVacuumUpdateDelay(), do_autovacuum(), table_recheck_autovac(), and vacuum_delay_point().
Definition at line 116 of file globals.c.
Referenced by MarkBufferDirty(), and MarkBufferDirtyHint().
Definition at line 114 of file globals.c.
Referenced by ReadBuffer_common().
Definition at line 115 of file globals.c.
Referenced by ReadBuffer_common().
| int VacuumPageDirty |
Definition at line 122 of file globals.c.
Referenced by lazy_vacuum_rel(), MarkBufferDirty(), MarkBufferDirtyHint(), and vacuum().
| int VacuumPageHit |
Definition at line 120 of file globals.c.
Referenced by lazy_vacuum_rel(), ReadBuffer_common(), and vacuum().
| int VacuumPageMiss |
Definition at line 121 of file globals.c.
Referenced by lazy_vacuum_rel(), ReadBuffer_common(), and vacuum().
| PGDLLIMPORT int work_mem |
Definition at line 101 of file globals.c.
Referenced by _bt_spoolinit(), begin_partition(), BuildTupleHashTable(), choose_hashed_distinct(), choose_hashed_grouping(), choose_hashed_setop(), collectMatchBitmap(), connectby(), cost_material(), cost_rescan(), create_merge_append_path(), create_unique_path(), crosstab(), dblink_get_notify(), deflist_to_tuplestore(), each_worker(), exec_init_tuple_store(), ExecChooseHashTableSize(), ExecHashTableCreate(), ExecInitCteScan(), ExecInitRecursiveUnion(), ExecMakeTableFunctionResult(), ExecMaterial(), ExecRecursiveUnion(), ExecSort(), final_cost_mergejoin(), fmgr_sql(), get_crosstab_tuplestore(), ginHeapTupleFastInsert(), initial_cost_mergejoin(), initialize_aggregates(), json_array_elements(), json_populate_recordset(), make_sort(), materializeQueryResult(), materializeResult(), MultiExecBitmapIndexScan(), MultiExecBitmapOr(), pg_available_extension_versions(), pg_available_extensions(), pg_cursor(), pg_event_trigger_dropped_objects(), pg_extension_update_paths(), pg_prepared_statement(), pg_stat_get_wal_senders(), pg_stat_statements(), plperl_return_next(), PortalCreateHoldStore(), query_planner(), storeRow(), subplan_is_hashable(), and xpath_table().
1.7.1