PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <sys/file.h>
#include <fcntl.h>
#include <unistd.h>
#include "access/htup_details.h"
#include "access/multixact.h"
#include "access/nbtree.h"
#include "access/parallel.h"
#include "access/reloptions.h"
#include "access/sysattr.h"
#include "access/table.h"
#include "access/tableam.h"
#include "access/tupdesc_details.h"
#include "access/xact.h"
#include "access/xlog.h"
#include "catalog/catalog.h"
#include "catalog/index.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/partition.h"
#include "catalog/pg_am.h"
#include "catalog/pg_amproc.h"
#include "catalog/pg_attrdef.h"
#include "catalog/pg_auth_members.h"
#include "catalog/pg_authid.h"
#include "catalog/pg_constraint.h"
#include "catalog/pg_database.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_opclass.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_publication.h"
#include "catalog/pg_rewrite.h"
#include "catalog/pg_shseclabel.h"
#include "catalog/pg_statistic_ext.h"
#include "catalog/pg_subscription.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_trigger.h"
#include "catalog/pg_type.h"
#include "catalog/schemapg.h"
#include "catalog/storage.h"
#include "commands/policy.h"
#include "commands/trigger.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/optimizer.h"
#include "rewrite/rewriteDefine.h"
#include "rewrite/rowsecurity.h"
#include "storage/lmgr.h"
#include "storage/smgr.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/datum.h"
#include "utils/fmgroids.h"
#include "utils/inval.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/relmapper.h"
#include "utils/resowner_private.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
Go to the source code of this file.
Data Structures | |
struct | relidcacheent |
struct | opclasscacheent |
Macros | |
#define | RELCACHE_INIT_FILEMAGIC 0x573266 /* version ID value */ |
#define | RECOVER_RELATION_BUILD_MEMORY 0 |
#define | MAX_EOXACT_LIST 32 |
#define | EOXactListAdd(rel) |
#define | RelationCacheInsert(RELATION, replace_allowed) |
#define | RelationIdCacheLookup(ID, RELATION) |
#define | RelationCacheDelete(RELATION) |
#define | SWAPFIELD(fldtype, fldname) |
#define | INITRELCACHESIZE 400 |
#define | NUM_CRITICAL_SHARED_RELS 5 /* fix if you change list above */ |
#define | NUM_CRITICAL_LOCAL_RELS 4 /* fix if you change list above */ |
#define | NUM_CRITICAL_LOCAL_INDEXES 7 /* fix if you change list above */ |
#define | NUM_CRITICAL_SHARED_INDEXES 6 /* fix if you change list above */ |
Typedefs | |
typedef struct relidcacheent | RelIdCacheEnt |
typedef struct opclasscacheent | OpClassCacheEnt |
Variables | |
static const FormData_pg_attribute | Desc_pg_class [Natts_pg_class] = {Schema_pg_class} |
static const FormData_pg_attribute | Desc_pg_attribute [Natts_pg_attribute] = {Schema_pg_attribute} |
static const FormData_pg_attribute | Desc_pg_proc [Natts_pg_proc] = {Schema_pg_proc} |
static const FormData_pg_attribute | Desc_pg_type [Natts_pg_type] = {Schema_pg_type} |
static const FormData_pg_attribute | Desc_pg_database [Natts_pg_database] = {Schema_pg_database} |
static const FormData_pg_attribute | Desc_pg_authid [Natts_pg_authid] = {Schema_pg_authid} |
static const FormData_pg_attribute | Desc_pg_auth_members [Natts_pg_auth_members] = {Schema_pg_auth_members} |
static const FormData_pg_attribute | Desc_pg_index [Natts_pg_index] = {Schema_pg_index} |
static const FormData_pg_attribute | Desc_pg_shseclabel [Natts_pg_shseclabel] = {Schema_pg_shseclabel} |
static const FormData_pg_attribute | Desc_pg_subscription [Natts_pg_subscription] = {Schema_pg_subscription} |
static HTAB * | RelationIdCache |
bool | criticalRelcachesBuilt = false |
bool | criticalSharedRelcachesBuilt = false |
static long | relcacheInvalsReceived = 0L |
static Oid | eoxact_list [MAX_EOXACT_LIST] |
static int | eoxact_list_len = 0 |
static bool | eoxact_list_overflowed = false |
static TupleDesc * | EOXactTupleDescArray |
static int | NextEOXactTupleDescNum = 0 |
static int | EOXactTupleDescArrayLen = 0 |
static HTAB * | OpClassCache = NULL |
#define EOXactListAdd | ( | rel | ) |
Definition at line 169 of file relcache.c.
Referenced by RelationAssumeNewRelfilenode(), and RelationBuildLocalRelation().
#define INITRELCACHESIZE 400 |
Definition at line 3774 of file relcache.c.
Referenced by RelationCacheInitialize().
#define MAX_EOXACT_LIST 32 |
Definition at line 164 of file relcache.c.
#define NUM_CRITICAL_LOCAL_INDEXES 7 /* fix if you change list above */ |
Referenced by load_relcache_init_file().
#define NUM_CRITICAL_LOCAL_RELS 4 /* fix if you change list above */ |
Referenced by load_relcache_init_file().
#define NUM_CRITICAL_SHARED_INDEXES 6 /* fix if you change list above */ |
Referenced by load_relcache_init_file().
#define NUM_CRITICAL_SHARED_RELS 5 /* fix if you change list above */ |
Referenced by load_relcache_init_file().
#define RECOVER_RELATION_BUILD_MEMORY 0 |
Definition at line 100 of file relcache.c.
Referenced by RelationBuildDesc().
#define RelationCacheDelete | ( | RELATION | ) |
Definition at line 223 of file relcache.c.
Referenced by RelationClearRelation().
#define RelationCacheInsert | ( | RELATION, | |
replace_allowed | |||
) |
Definition at line 189 of file relcache.c.
Referenced by formrdesc(), load_relcache_init_file(), RelationBuildDesc(), and RelationBuildLocalRelation().
#define RelationIdCacheLookup | ( | ID, | |
RELATION | |||
) |
Definition at line 211 of file relcache.c.
Referenced by RelationCacheInvalidateEntry(), RelationCloseSmgrByOid(), RelationForgetRelation(), and RelationIdGetRelation().
#define RELCACHE_INIT_FILEMAGIC 0x573266 /* version ID value */ |
Definition at line 91 of file relcache.c.
Referenced by load_relcache_init_file(), and write_relcache_init_file().
#define SWAPFIELD | ( | fldtype, | |
fldname | |||
) |
Referenced by RelationClearRelation().
typedef struct opclasscacheent OpClassCacheEnt |
typedef struct relidcacheent RelIdCacheEnt |
|
static |
Definition at line 386 of file relcache.c.
References CacheMemoryContext, CLASS_TUPLE_SIZE, CreateTemplateTupleDesc(), MemoryContextSwitchTo(), palloc(), palloc0(), RelationData::rd_att, RelationData::rd_rel, RelationData::rd_smgr, and TupleDescData::tdrefcount.
Referenced by RelationBuildDesc().
|
static |
Definition at line 3274 of file relcache.c.
References Assert, elog, InvalidSubTransactionId, RelationData::rd_createSubid, RelationData::rd_droppedSubid, RelationData::rd_firstRelfilenodeSubid, RelationData::rd_newRelfilenodeSubid, RelationClearRelation(), RelationGetRelationName, RelationHasReferenceCountZero, and WARNING.
Referenced by AtEOSubXact_RelationCache().
void AtEOSubXact_RelationCache | ( | bool | isCommit, |
SubTransactionId | mySubid, | ||
SubTransactionId | parentSubid | ||
) |
Definition at line 3227 of file relcache.c.
References AtEOSubXact_cleanup(), eoxact_list, eoxact_list_len, eoxact_list_overflowed, HASH_FIND, hash_search(), hash_seq_init(), hash_seq_search(), i, relidcacheent::reldesc, and status().
Referenced by AbortSubTransaction(), and CommitSubTransaction().
Definition at line 3145 of file relcache.c.
References Assert, elog, InvalidSubTransactionId, IsBootstrapProcessingMode, RelationData::rd_createSubid, RelationData::rd_droppedSubid, RelationData::rd_firstRelfilenodeSubid, RelationData::rd_isnailed, RelationData::rd_newRelfilenodeSubid, RelationData::rd_refcnt, RelationClearRelation(), RelationGetRelationName, RelationHasReferenceCountZero, and WARNING.
Referenced by AtEOXact_RelationCache().
void AtEOXact_RelationCache | ( | bool | isCommit | ) |
Definition at line 3082 of file relcache.c.
References Assert, AtEOXact_cleanup(), eoxact_list, eoxact_list_len, eoxact_list_overflowed, EOXactTupleDescArrayLen, FreeTupleDesc(), HASH_FIND, hash_search(), hash_seq_init(), hash_seq_search(), i, NextEOXactTupleDescNum, pfree(), relidcacheent::reldesc, and status().
Referenced by AbortTransaction(), CommitTransaction(), and PrepareTransaction().
|
static |
Definition at line 4253 of file relcache.c.
References AccessShareLock, AttrDefault::adbin, AttrDefault::adnum, AttrDefaultIndexId, BTEqualStrategyNumber, CacheMemoryContext, TupleDescData::constr, TupleConstr::defval, elog, fastgetattr, GETSTRUCT, HeapTupleIsValid, i, MemoryContextStrdup(), NameStr, TupleConstr::num_defval, ObjectIdGetDatum, pfree(), RelationData::rd_att, RelationGetRelationName, RelationGetRelid, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), TextDatumGetCString, TupleDescAttr, val, and WARNING.
Referenced by RelationBuildTupleDesc().
|
static |
Definition at line 4194 of file relcache.c.
References ATTRIBUTE_FIXED_PART_SIZE, CacheMemoryContext, CreateTemplateTupleDesc(), i, MemoryContextSwitchTo(), TupleDescData::tdtypeid, TupleDescData::tdtypmod, and TupleDescAttr.
Referenced by GetPgClassDescriptor(), and GetPgIndexDescriptor().
|
static |
Definition at line 4394 of file relcache.c.
References ConstrCheck::ccname.
Referenced by CheckConstraintFetch().
|
static |
Definition at line 4323 of file relcache.c.
References AccessShareLock, BTEqualStrategyNumber, CacheMemoryContext, ConstrCheck::ccbin, ConstrCheck::ccname, ConstrCheck::ccnoinherit, ConstrCheck::ccvalid, TupleConstr::check, CheckConstraintCmp(), TupleDescData::constr, ConstraintRelidTypidNameIndexId, elog, ERROR, fastgetattr, GETSTRUCT, HeapTupleIsValid, MemoryContextStrdup(), NameStr, TupleConstr::num_check, ObjectIdGetDatum, pfree(), qsort, RelationData::rd_att, RelationGetRelationName, RelationGetRelid, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), TextDatumGetCString, and val.
Referenced by RelationBuildTupleDesc().
Definition at line 5428 of file relcache.c.
References datumCopy(), DatumGetPointer, i, palloc(), and PointerGetDatum.
Referenced by RelationGetIndexAttOptions().
|
static |
Definition at line 942 of file relcache.c.
References ARR_DATA_PTR, ARR_DIMS, equal(), RowSecurityPolicy::hassublinks, i, RowSecurityPolicy::polcmd, RowSecurityPolicy::policy_name, RowSecurityPolicy::qual, RowSecurityPolicy::roles, and RowSecurityPolicy::with_check_qual.
Referenced by equalRSDesc().
|
static |
Definition at line 988 of file relcache.c.
References equalPolicy(), forboth, lfirst, list_length(), and RowSecurityDesc::policies.
Referenced by RelationClearRelation().
Definition at line 897 of file relcache.c.
References RewriteRule::actions, RewriteRule::enabled, equal(), RewriteRule::event, i, RewriteRule::isInstead, RuleLock::numLocks, RewriteRule::qual, RewriteRule::ruleId, and RuleLock::rules.
Referenced by RelationClearRelation().
int errtable | ( | Relation | rel | ) |
Definition at line 5509 of file relcache.c.
References err_generic_string(), get_namespace_name(), PG_DIAG_SCHEMA_NAME, PG_DIAG_TABLE_NAME, RelationGetNamespace, and RelationGetRelationName.
Referenced by ATPrepChangePersistence(), ATRewriteTable(), BuildRelationExtStatistics(), check_default_partition_contents(), errtablecolname(), errtableconstraint(), ExecFindPartition(), and ExecPartitionCheckEmitError().
int errtablecol | ( | Relation | rel, |
int | attnum | ||
) |
Definition at line 5526 of file relcache.c.
References attname, errtablecolname(), get_attname(), NameStr, RelationGetDescr, RelationGetRelid, relidcacheent::reldesc, and TupleDescAttr.
Referenced by AlterDomainNotNull(), ATRewriteTable(), ExecConstraints(), and validateDomainConstraint().
int errtablecolname | ( | Relation | rel, |
const char * | colname | ||
) |
Definition at line 5550 of file relcache.c.
References err_generic_string(), errtable(), and PG_DIAG_COLUMN_NAME.
Referenced by errtablecol().
int errtableconstraint | ( | Relation | rel, |
const char * | conname | ||
) |
Definition at line 5563 of file relcache.c.
References err_generic_string(), errtable(), and PG_DIAG_CONSTRAINT_NAME.
Referenced by _bt_check_third_page(), _bt_check_unique(), ATPrepChangePersistence(), ATRewriteTable(), check_exclusion_or_unique_constraint(), comparetup_index_btree(), ExecCheckIndexConstraints(), ExecConstraints(), RI_FKey_check(), RI_Initial_Check(), and ri_ReportViolation().
|
static |
Definition at line 1829 of file relcache.c.
References ATTRIBUTE_FIXED_PART_SIZE, CLASS_TUPLE_SIZE, TupleDescData::constr, CreateTemplateTupleDesc(), GetHeapamTableAmRoutine(), TupleConstr::has_not_null, i, InvalidBackendId, InvalidOid, InvalidSubTransactionId, IsBootstrapProcessingMode, namestrcpy(), palloc0(), RelationData::rd_att, RelationData::rd_backend, RelationData::rd_createSubid, RelationData::rd_droppedSubid, RelationData::rd_firstRelfilenodeSubid, RelationData::rd_islocaltemp, RelationData::rd_isnailed, RelationData::rd_isvalid, RelationData::rd_newRelfilenodeSubid, RelationData::rd_refcnt, RelationData::rd_rel, RelationData::rd_smgr, RelationData::rd_tableam, RelationCacheInsert, RelationGetRelid, RelationInitLockInfo(), RelationInitPhysicalAddr(), RelationMapUpdateMap(), TupleDescData::tdrefcount, TupleDescData::tdtypeid, TupleDescData::tdtypmod, and TupleDescAttr.
Referenced by RelationCacheInitializePhase2(), and RelationCacheInitializePhase3().
|
static |
Definition at line 4224 of file relcache.c.
References BuildHardcodedDescriptor(), and Desc_pg_class.
Referenced by RelationParseRelOptions().
|
static |
Definition at line 4237 of file relcache.c.
References BuildHardcodedDescriptor(), and Desc_pg_index.
Referenced by RelationGetDummyIndexExpressions(), RelationGetIndexAttrBitmap(), RelationGetIndexExpressions(), RelationGetIndexPredicate(), and RelationInitIndexAccessInfo().
struct PublicationActions* GetRelationPublicationActions | ( | Relation | relation | ) |
Definition at line 5318 of file relcache.c.
References CacheMemoryContext, elog, ERROR, get_partition_ancestors(), GetAllTablesPublications(), GetRelationPublications(), GETSTRUCT, HeapTupleIsValid, is_publishable_relation(), lfirst_oid, list_concat_unique_oid(), MemoryContextSwitchTo(), ObjectIdGetDatum, palloc(), palloc0(), pfree(), PublicationActions::pubdelete, PublicationActions::pubinsert, PUBLICATIONOID, PublicationActions::pubtruncate, PublicationActions::pubupdate, RelationData::rd_pubactions, RelationData::rd_rel, RelationGetRelid, ReleaseSysCache(), and SearchSysCache1().
Referenced by CheckCmdReplicaIdentity().
|
static |
Definition at line 1555 of file relcache.c.
References elog, ERROR, LookupOpclassInfo(), OidIsValid, opclasscacheent::opcfamily, opclasscacheent::opcintype, opclasscacheent::supportProcs, and oidvector::values.
Referenced by RelationInitIndexAccessInfo().
|
static |
Definition at line 1361 of file relcache.c.
References GetIndexAmRoutine(), MemoryContextAlloc(), pfree(), RelationData::rd_amhandler, RelationData::rd_indam, and RelationData::rd_indexcxt.
Referenced by load_relcache_init_file(), and RelationInitIndexAccessInfo().
|
static |
Definition at line 1756 of file relcache.c.
References GetTableAmRoutine(), RelationData::rd_amhandler, and RelationData::rd_tableam.
Referenced by RelationInitTableAccessMethod().
Definition at line 4158 of file relcache.c.
References AccessShareLock, elog, LockRelationOid(), PANIC, RelationData::rd_isnailed, RelationData::rd_refcnt, RelationBuildDesc(), RelationGetIndexAttOptions(), and UnlockRelationOid().
Referenced by RelationCacheInitializePhase3().
Definition at line 5627 of file relcache.c.
References AllocateFile(), ALLOCSET_SMALL_SIZES, AllocSetContextCreate, IndexAmRoutine::amsupport, Assert, ATTRIBUTE_FIXED_PART_SIZE, CacheMemoryContext, TupleDescData::constr, CreateTemplateTupleDesc(), criticalRelcachesBuilt, criticalSharedRelcachesBuilt, DatabasePath, elog, FreeFile(), GETSTRUCT, TupleConstr::has_not_null, HEAPTUPLESIZE, i, InitIndexAmRoutine(), InvalidOid, InvalidSubTransactionId, MAXPGPATH, MemoryContextAlloc(), MemoryContextAllocZero(), MemoryContextCopyAndSetIdentifier, MemSet, NIL, NUM_CRITICAL_LOCAL_INDEXES, NUM_CRITICAL_LOCAL_RELS, NUM_CRITICAL_SHARED_INDEXES, NUM_CRITICAL_SHARED_RELS, palloc(), palloc0(), pfree(), PG_BINARY_R, RelationData::pgstat_info, RelationData::rd_amcache, RelationData::rd_att, RelationData::rd_createSubid, RelationData::rd_droppedSubid, RelationData::rd_exclops, RelationData::rd_exclprocs, RelationData::rd_exclstrats, RelationData::rd_fdwroutine, RelationData::rd_firstRelfilenodeSubid, RelationData::rd_fkeylist, RelationData::rd_fkeyvalid, RelationData::rd_idattr, RelationData::rd_indam, RelationData::rd_indcollation, RelationData::rd_index, RelationData::rd_indexattr, RelationData::rd_indexcxt, RelationData::rd_indexlist, RelationData::rd_indexprs, RelationData::rd_indextuple, RelationData::rd_indexvalid, RelationData::rd_indoption, RelationData::rd_indpred, RelationData::rd_isnailed, RelationData::rd_keyattr, RelationData::rd_newRelfilenodeSubid, RelationData::rd_opcintype, RelationData::rd_opcoptions, RelationData::rd_opfamily, RelationData::rd_options, RelationData::rd_partcheck, RelationData::rd_partcheckcxt, RelationData::rd_partcheckvalid, RelationData::rd_partdesc, RelationData::rd_partkey, RelationData::rd_partkeycxt, RelationData::rd_pdcxt, RelationData::rd_pkattr, RelationData::rd_pkindex, RelationData::rd_pubactions, RelationData::rd_refcnt, RelationData::rd_rel, RelationData::rd_replidindex, RelationData::rd_rsdesc, RelationData::rd_rules, RelationData::rd_rulescxt, RelationData::rd_smgr, RelationData::rd_statlist, RelationData::rd_statvalid, RelationData::rd_support, RelationData::rd_supportinfo, RelationData::rd_version_checked, RelationCacheInsert, RelationGetRelationName, RelationInitLockInfo(), RelationInitPhysicalAddr(), RelationInitTableAccessMethod(), RELCACHE_INIT_FILEMAGIC, RELCACHE_INIT_FILENAME, repalloc(), snprintf, HeapTupleData::t_data, TupleDescData::tdrefcount, TupleDescData::tdtypeid, TupleDescData::tdtypmod, RelationData::trigdesc, TupleDescAttr, VARSIZE, and WARNING.
Referenced by RelationCacheInitializePhase2(), and RelationCacheInitializePhase3().
|
static |
Definition at line 1606 of file relcache.c.
References AccessMethodProcedureIndexId, AccessShareLock, Assert, BTEqualStrategyNumber, CacheMemoryContext, CreateCacheMemoryContext(), criticalRelcachesBuilt, debug_invalidate_system_caches_always, elog, HASHCTL::entrysize, ERROR, GETSTRUCT, HASH_BLOBS, hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), HeapTupleIsValid, HASHCTL::keysize, MemoryContextAllocZero(), opclasscacheent::numSupport, ObjectIdGetDatum, opclasscacheent::opcfamily, opclasscacheent::opcintype, OpclassOidIndexId, ScanKeyInit(), opclasscacheent::supportProcs, systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), and opclasscacheent::valid.
Referenced by IndexSupportInitialize().
void RelationAssumeNewRelfilenode | ( | Relation | relation | ) |
Definition at line 3751 of file relcache.c.
References EOXactListAdd, GetCurrentSubTransactionId(), InvalidSubTransactionId, RelationData::rd_firstRelfilenodeSubid, and RelationData::rd_newRelfilenodeSubid.
Referenced by ATExecSetTableSpace(), RelationSetNewRelfilenode(), and swap_relation_files().
Definition at line 1029 of file relcache.c.
References AllocateRelationDesc(), ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, BackendIdForTempRelations, CurrentMemoryContext, debug_invalidate_system_caches_always, elog, ERROR, GETSTRUCT, GetTempNamespaceBackendId(), heap_freetuple(), HeapTupleIsValid, InvalidBackendId, InvalidOid, InvalidSubTransactionId, isTempOrTempToastNamespace(), MemoryContextDelete(), MemoryContextSwitchTo(), NIL, RelationData::rd_backend, RelationData::rd_createSubid, RelationData::rd_droppedSubid, RelationData::rd_firstRelfilenodeSubid, RelationData::rd_fkeylist, RelationData::rd_fkeyvalid, RelationData::rd_islocaltemp, RelationData::rd_isnailed, RelationData::rd_isvalid, RelationData::rd_newRelfilenodeSubid, RelationData::rd_partcheck, RelationData::rd_partcheckcxt, RelationData::rd_partcheckvalid, RelationData::rd_partdesc, RelationData::rd_partkey, RelationData::rd_partkeycxt, RelationData::rd_pdcxt, RelationData::rd_refcnt, RelationData::rd_rel, RelationData::rd_rsdesc, RelationData::rd_rules, RelationData::rd_rulescxt, RelationData::rd_smgr, RECOVER_RELATION_BUILD_MEMORY, RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationCacheInsert, RelationGetRelid, RelationInitIndexAccessInfo(), RelationInitLockInfo(), RelationInitPhysicalAddr(), RelationInitTableAccessMethod(), RelationParseRelOptions(), ScanPgRelation(), and RelationData::trigdesc.
Referenced by load_critical_index(), RelationClearRelation(), and RelationIdGetRelation().
Relation RelationBuildLocalRelation | ( | const char * | relname, |
Oid | relnamespace, | ||
TupleDesc | tupDesc, | ||
Oid | relid, | ||
Oid | accessmtd, | ||
Oid | relfilenode, | ||
Oid | reltablespace, | ||
bool | shared_relation, | ||
bool | mapped_relation, | ||
char | relpersistence, | ||
char | relkind | ||
) |
Definition at line 3356 of file relcache.c.
References Assert, AssertArg, BackendIdForTempRelations, CacheMemoryContext, CLASS_TUPLE_SIZE, TupleDescData::constr, CreateCacheMemoryContext(), CreateTupleDescCopy(), elog, EOXactListAdd, ERROR, GetCurrentSubTransactionId(), TupleConstr::has_not_null, i, InvalidBackendId, InvalidOid, InvalidSubTransactionId, IsCatalogNamespace(), IsSharedRelation(), isTempOrTempToastNamespace(), MemoryContextSwitchTo(), namestrcpy(), TupleDescData::natts, palloc0(), RelationData::rd_att, RelationData::rd_backend, RelationData::rd_createSubid, RelationData::rd_droppedSubid, RelationData::rd_firstRelfilenodeSubid, RelationData::rd_islocaltemp, RelationData::rd_isnailed, RelationData::rd_isvalid, RelationData::rd_newRelfilenodeSubid, RelationData::rd_refcnt, RelationData::rd_rel, RelationData::rd_smgr, RelationCacheInsert, RelationGetRelid, RelationIncrementReferenceCount(), RelationInitLockInfo(), RelationInitPhysicalAddr(), RelationInitTableAccessMethod(), RelationMapUpdateMap(), TupleDescData::tdrefcount, and TupleDescAttr.
Referenced by heap_create().
|
static |
Definition at line 736 of file relcache.c.
References AccessShareLock, RewriteRule::actions, ALLOCSET_SMALL_SIZES, AllocSetContextCreate, Assert, BTEqualStrategyNumber, CacheMemoryContext, RewriteRule::enabled, RewriteRule::event, GETSTRUCT, heap_getattr, HeapTupleIsValid, RewriteRule::isInstead, sort-test::key, MemoryContextAlloc(), MemoryContextCopyAndSetIdentifier, MemoryContextDelete(), MemoryContextSwitchTo(), RuleLock::numLocks, ObjectIdGetDatum, pfree(), RewriteRule::qual, RelationData::rd_rel, RelationData::rd_rules, RelationData::rd_rulescxt, RelationGetDescr, RelationGetRelationName, RelationGetRelid, repalloc(), RewriteRelRulenameIndexId, RewriteRule::ruleId, RuleLock::rules, rules, ScanKeyInit(), setRuleCheckAsUser(), stringToNode(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), and TextDatumGetCString.
Referenced by RelationBuildDesc(), and RelationCacheInitializePhase3().
|
static |
Definition at line 498 of file relcache.c.
References AccessShareLock, AttrDefault::adbin, AttrDefault::adnum, AttrMissing::am_present, AttrMissing::am_value, array_get_element(), Assert, attnum, AttrDefaultFetch(), ATTRIBUTE_FIXED_PART_SIZE, AttributeRelidNumIndexId, BTEqualStrategyNumber, BTGreaterStrategyNumber, CacheMemoryContext, TupleConstr::check, CheckConstraintFetch(), TupleDescData::constr, criticalRelcachesBuilt, datumCopy(), TupleConstr::defval, elog, ERROR, GETSTRUCT, TupleConstr::has_generated_stored, TupleConstr::has_not_null, heap_getattr, HeapTupleIsValid, i, Int16GetDatum, MemoryContextAlloc(), MemoryContextAllocZero(), MemoryContextSwitchTo(), TupleConstr::missing, TupleConstr::num_check, TupleConstr::num_defval, ObjectIdGetDatum, pfree(), RelationData::rd_att, RelationData::rd_rel, RelationGetNumberOfAttributes, RelationGetRelationName, RelationGetRelid, repalloc(), ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), TupleDescData::tdtypeid, TupleDescData::tdtypmod, and TupleDescAttr.
Referenced by RelationBuildDesc().
void RelationCacheInitFilePostInvalidate | ( | void | ) |
Definition at line 6336 of file relcache.c.
References LWLockRelease().
Referenced by AtEOXact_Inval(), FinishPreparedTransaction(), and ProcessCommittedInvalidationMessages().
void RelationCacheInitFilePreInvalidate | ( | void | ) |
Definition at line 6311 of file relcache.c.
References DatabasePath, ERROR, LW_EXCLUSIVE, LWLockAcquire(), MAXPGPATH, RELCACHE_INIT_FILENAME, snprintf, and unlink_initfile().
Referenced by AtEOXact_Inval(), FinishPreparedTransaction(), and ProcessCommittedInvalidationMessages().
void RelationCacheInitFileRemove | ( | void | ) |
Definition at line 6351 of file relcache.c.
References AllocateDir(), dirent::d_name, FreeDir(), LOG, MAXPGPATH, ReadDirExtended(), RelationCacheInitFileRemoveInDir(), RELCACHE_INIT_FILENAME, snprintf, TABLESPACE_VERSION_DIRECTORY, and unlink_initfile().
Referenced by StartupXLOG().
|
static |
Definition at line 6384 of file relcache.c.
References AllocateDir(), dirent::d_name, FreeDir(), LOG, MAXPGPATH, ReadDirExtended(), RELCACHE_INIT_FILENAME, snprintf, and unlink_initfile().
Referenced by RelationCacheInitFileRemove().
void RelationCacheInitialize | ( | void | ) |
Definition at line 3777 of file relcache.c.
References CacheMemoryContext, CreateCacheMemoryContext(), HASHCTL::entrysize, HASH_BLOBS, hash_create(), HASH_ELEM, INITRELCACHESIZE, HASHCTL::keysize, and RelationMapInitialize().
Referenced by InitPostgres().
void RelationCacheInitializePhase2 | ( | void | ) |
Definition at line 3813 of file relcache.c.
References CacheMemoryContext, Desc_pg_auth_members, Desc_pg_authid, Desc_pg_database, Desc_pg_shseclabel, Desc_pg_subscription, formrdesc(), IsBootstrapProcessingMode, load_relcache_init_file(), MemoryContextSwitchTo(), and RelationMapInitializePhase2().
Referenced by InitPostgres().
void RelationCacheInitializePhase3 | ( | void | ) |
Definition at line 3872 of file relcache.c.
References AccessMethodProcedureIndexId, Assert, AttributeRelidNumIndexId, AuthIdOidIndexId, AuthIdRolnameIndexId, AuthMemMemRoleIndexId, CacheMemoryContext, CLASS_TUPLE_SIZE, ClassOidIndexId, criticalRelcachesBuilt, criticalSharedRelcachesBuilt, DatabaseNameIndexId, DatabaseOidIndexId, Desc_pg_attribute, Desc_pg_class, Desc_pg_proc, Desc_pg_type, elog, ERROR, FATAL, formrdesc(), GETSTRUCT, hash_seq_init(), hash_seq_search(), hash_seq_term(), HeapTupleIsValid, IndexRelidIndexId, InitCatalogCachePhase2(), InvalidOid, IsBootstrapProcessingMode, load_critical_index(), load_relcache_init_file(), MemoryContextSwitchTo(), ObjectIdGetDatum, OpclassOidIndexId, pfree(), RelationData::rd_att, RelationData::rd_options, RelationData::rd_rel, RelationData::rd_rsdesc, RelationData::rd_rules, RelationData::rd_tableam, RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationDecrementReferenceCount(), RelationGetRelationName, RelationGetRelid, RelationIncrementReferenceCount(), RelationInitTableAccessMethod(), RelationMapInitializePhase3(), RelationParseRelOptions(), relidcacheent::reldesc, ReleaseSysCache(), RELOID, RewriteRelRulenameIndexId, SearchSysCache1(), SharedSecLabelObjectIndexId, status(), TupleDescData::tdtypeid, TupleDescData::tdtypmod, RelationData::trigdesc, TriggerRelidNameIndexId, and write_relcache_init_file().
Referenced by InitPostgres().
void RelationCacheInvalidate | ( | void | ) |
Definition at line 2844 of file relcache.c.
References Assert, ClassOidIndexId, hash_seq_init(), hash_seq_search(), InvalidSubTransactionId, lappend(), lcons(), lfirst, list_free(), NIL, RelationData::rd_createSubid, RelationData::rd_firstRelfilenodeSubid, RelationData::rd_isnailed, RelationClearRelation(), RelationCloseSmgr, RelationGetRelid, RelationHasReferenceCountZero, RelationInitPhysicalAddr(), RelationIsMapped, RelationMapInvalidateAll(), relcacheInvalsReceived, relidcacheent::reldesc, smgrcloseall(), and status().
Referenced by InvalidateSystemCaches(), and LocalExecuteInvalidationMessage().
void RelationCacheInvalidateEntry | ( | Oid | relationId | ) |
Definition at line 2801 of file relcache.c.
References PointerIsValid, RelationFlushRelation(), RelationIdCacheLookup, and relcacheInvalsReceived.
Referenced by LocalExecuteInvalidationMessage().
Definition at line 2444 of file relcache.c.
References Assert, CLASS_TUPLE_SIZE, elog, equalRSDesc(), equalRuleLocks(), equalTupleDescs(), ERROR, HistoricSnapshotActive(), InvalidSubTransactionId, IsTransactionState(), MemoryContextSetParent(), pfree(), RelationData::rd_amcache, RelationData::rd_att, RelationData::rd_droppedSubid, RelationData::rd_indexcxt, RelationData::rd_isnailed, RelationData::rd_isvalid, RelationData::rd_partdesc, RelationData::rd_partkey, RelationData::rd_pdcxt, RelationData::rd_refcnt, RelationData::rd_rel, RelationData::rd_rsdesc, RelationData::rd_rules, RelationBuildDesc(), RelationCacheDelete, RelationCloseSmgr, RelationDestroyRelation(), RelationGetRelid, RelationHasReferenceCountZero, RelationReloadIndexInfo(), RelationReloadNailed(), and SWAPFIELD.
Referenced by AtEOSubXact_cleanup(), AtEOXact_cleanup(), RelationCacheInvalidate(), RelationClose(), RelationFlushRelation(), RelationForgetRelation(), and RelationIdGetRelation().