Header And Logo

PostgreSQL
| The world's most advanced open source database.

Data Structures | Defines | Typedefs | Functions

rel.h File Reference

#include "access/tupdesc.h"
#include "catalog/pg_am.h"
#include "catalog/pg_class.h"
#include "catalog/pg_index.h"
#include "fmgr.h"
#include "nodes/bitmapset.h"
#include "rewrite/prs2lock.h"
#include "storage/block.h"
#include "storage/relfilenode.h"
#include "utils/relcache.h"
#include "utils/reltrigger.h"
Include dependency graph for rel.h:

Go to the source code of this file.

Data Structures

struct  LockRelId
struct  LockInfoData
struct  RelationAmInfo
struct  RelationData
struct  AutoVacOpts
struct  StdRdOptions

Defines

#define HEAP_MIN_FILLFACTOR   10
#define HEAP_DEFAULT_FILLFACTOR   100
#define RelationGetFillFactor(relation, defaultff)
#define RelationGetTargetPageUsage(relation, defaultff)   (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100)
#define RelationGetTargetPageFreeSpace(relation, defaultff)   (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100)
#define RelationIsSecurityView(relation)
#define RelationIsValid(relation)   PointerIsValid(relation)
#define InvalidRelation   ((Relation) NULL)
#define RelationHasReferenceCountZero(relation)   ((bool)((relation)->rd_refcnt == 0))
#define RelationGetForm(relation)   ((relation)->rd_rel)
#define RelationGetRelid(relation)   ((relation)->rd_id)
#define RelationGetNumberOfAttributes(relation)   ((relation)->rd_rel->relnatts)
#define RelationGetDescr(relation)   ((relation)->rd_att)
#define RelationGetRelationName(relation)   (NameStr((relation)->rd_rel->relname))
#define RelationGetNamespace(relation)   ((relation)->rd_rel->relnamespace)
#define RelationIsMapped(relation)   ((relation)->rd_rel->relfilenode == InvalidOid)
#define RelationOpenSmgr(relation)
#define RelationCloseSmgr(relation)
#define RelationGetTargetBlock(relation)   ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber )
#define RelationSetTargetBlock(relation, targblock)
#define RelationNeedsWAL(relation)   ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
#define RelationUsesLocalBuffers(relation)   ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
#define RELATION_IS_LOCAL(relation)
#define RELATION_IS_OTHER_TEMP(relation)
#define RelationIsScannable(relation)   ((relation)->rd_ispopulated)

Typedefs

typedef struct LockRelId LockRelId
typedef struct LockInfoData LockInfoData
typedef LockInfoDataLockInfo
typedef struct RelationAmInfo RelationAmInfo
typedef struct RelationData RelationData
typedef struct AutoVacOpts AutoVacOpts
typedef struct StdRdOptions StdRdOptions

Functions

void RelationIncrementReferenceCount (Relation rel)
void RelationDecrementReferenceCount (Relation rel)

Define Documentation

#define HEAP_DEFAULT_FILLFACTOR   100
#define HEAP_MIN_FILLFACTOR   10

Definition at line 219 of file rel.h.

#define InvalidRelation   ((Relation) NULL)

Definition at line 258 of file rel.h.

#define RELATION_IS_LOCAL (   relation  ) 
Value:
((relation)->rd_islocaltemp || \
     (relation)->rd_createSubid != InvalidSubTransactionId)

Definition at line 390 of file rel.h.

Referenced by _bt_getbuf(), btvacuumscan(), GinNewBuffer(), ginvacuumcleanup(), gistNewBuffer(), gistvacuumcleanup(), RelationGetBufferForTuple(), SpGistNewBuffer(), and spgvacuumscan().

#define RELATION_IS_OTHER_TEMP (   relation  ) 
#define RelationCloseSmgr (   relation  ) 
Value:
do { \
        if ((relation)->rd_smgr != NULL) \
        { \
            smgrclose((relation)->rd_smgr); \
            Assert((relation)->rd_smgr == NULL); \
        } \
    } while (0)

Definition at line 339 of file rel.h.

Referenced by RelationCacheInvalidate(), RelationClearRelation(), RelationCloseSmgrByOid(), RelationDestroyRelation(), and RelationDropStorage().

#define RelationGetDescr (   relation  )     ((relation)->rd_att)

Definition at line 295 of file rel.h.

Referenced by _bt_check_unique(), _bt_checkkeys(), _bt_compare(), _bt_load(), _bt_mkscankey(), _hash_checkqual(), _hash_form_tuple(), acquire_inherited_sample_rows(), AddEnumLabel(), AddRelationNewConstraints(), AddRoleMems(), AlterDatabase(), AlterDatabaseOwner(), AlterDomainDefault(), AlterDomainNotNull(), AlterForeignDataWrapper(), AlterForeignServer(), AlterFunction(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterRole(), AlterSchemaOwner_internal(), AlterSetting(), AlterTableSpaceOptions(), AlterTSDictionary(), AlterUserMapping(), AppendAttributeTuples(), ApplyExtensionUpdates(), ApplySetting(), ATExecAddOf(), ATExecAlterColumnGenericOptions(), ATExecChangeOwner(), ATExecGenericOptions(), ATExecSetOptions(), ATExecSetRelOptions(), ATGetQueueEntry(), ATRewriteTable(), BeginCopy(), BeginCopyFrom(), btbeginscan(), btbuildCallback(), btinsert(), build_row_from_class(), BuildEventTriggerCache(), CatalogCacheInitializeCache(), CatalogIndexInsert(), change_owner_fix_column_acls(), check_exclusion_constraint(), check_functional_grouping(), check_selective_binary_conversion(), CheckAttributeType(), CollationCreate(), comparetup_index_btree(), compute_index_stats(), ConstructTupleDescriptor(), conversion_error_callback(), copy_heap_data(), CopyFrom(), copyTemplateDependencies(), CopyTo(), copytup_index(), create_proc_lang(), CreateCast(), CreateComments(), CreateConstraintEntry(), createdb(), CreateRole(), CreateSharedComments(), currtid_for_view(), DefineQueryRewrite(), DefineSequence(), DelRoleMems(), deparseAnalyzeSql(), deparseTargetList(), do_autovacuum(), DoCopy(), EnumValuesCreate(), errtablecol(), EventTriggerSQLDropAddObject(), ExecAlterExtensionStmt(), ExecBRInsertTriggers(), ExecBRUpdateTriggers(), ExecCheckPlanOutput(), ExecDelete(), ExecGrant_Attribute(), ExecGrant_Database(), ExecGrant_Fdw(), ExecGrant_ForeignServer(), ExecGrant_Function(), ExecGrant_Language(), ExecGrant_Largeobject(), ExecGrant_Namespace(), ExecGrant_Relation(), ExecGrant_Tablespace(), ExecGrant_Type(), ExecInitBitmapHeapScan(), ExecInitForeignScan(), ExecInitIndexScan(), ExecInitTidScan(), ExecIRInsertTriggers(), ExecIRUpdateTriggers(), extension_config_remove(), file_acquire_sample_rows(), find_language_template(), generateClonedIndexStmt(), get_actual_variable_range(), get_file_fdw_attribute_options(), GetComment(), GetSecurityLabel(), GetSharedSecurityLabel(), heapgettup(), heapgettup_pagemode(), HeapSatisfiesHOTandKeyUpdate(), IndexBuildHeapScan(), IndexCheckExclusion(), initGinState(), InitializeAttributeOids(), InitScanRelation(), InsertPgAttributeTuple(), InsertPgClassTuple(), InsertRule(), inv_truncate(), inv_write(), LargeObjectCreate(), load_typcache_tupdesc(), make_inh_translation_list(), make_new_heap(), make_tuple_from_result_row(), make_viewdef(), MakeConfigurationMapping(), MergeAttributes(), MergeAttributesIntoExisting(), MergeConstraintsIntoExisting(), movedb(), NextCopyFrom(), OperatorCreate(), OperatorUpd(), pg_extension_config_dump(), pg_identify_object(), pg_largeobject_aclmask_snapshot(), postgresAcquireSampleRowsFunc(), postgresBeginForeignModify(), postgresBeginForeignScan(), postgresPlanForeignModify(), ProcedureCreate(), RangeCreate(), readtup_index(), RelationBuildRuleLock(), RelationNameGetTupleDesc(), RenameRole(), ri_KeysEqual(), sepgsql_relation_setattr_extra(), set_relation_column_names(), SetDefaultACL(), SetSecurityLabel(), SetSharedSecurityLabel(), shdepChangeDep(), spgbeginscan(), StoreCatalogInheritance1(), transformTableLikeClause(), TriggerEnabled(), TypeCreate(), update_attstats(), UpdateIndexRelation(), validate_index_heapscan(), validateCheckConstraint(), and validateDomainConstraint().

#define RelationGetFillFactor (   relation,
  defaultff 
)
Value:
((relation)->rd_options ? \
     ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff))

Definition at line 226 of file rel.h.

Referenced by _bt_findsplitloc().

#define RelationGetForm (   relation  )     ((relation)->rd_rel)
#define RelationGetNamespace (   relation  )     ((relation)->rd_rel->relnamespace)
#define RelationGetNumberOfAttributes (   relation  )     ((relation)->rd_rel->relnatts)
#define RelationGetRelationName (   relation  )     (NameStr((relation)->rd_rel->relname))

Definition at line 303 of file rel.h.

Referenced by _bt_buildadd(), _bt_check_unique(), _bt_checkpage(), _bt_findinsertloc(), _bt_findsplitloc(), _bt_first(), _bt_get_endpoint(), _bt_getroot(), _bt_getrootheight(), _bt_gettrueroot(), _bt_insert_parent(), _bt_insertonpg(), _bt_moveright(), _bt_newroot(), _bt_pagedel(), _bt_parent_deletion_safe(), _bt_split(), _bt_start_vacuum(), _bt_walk_left(), _hash_checkpage(), _hash_datum2hashkey_type(), _hash_getnewbuf(), _hash_initbitmap(), _hash_metapinit(), _hash_pgaddtup(), acquire_sample_rows(), addRangeTableEntryForRelation(), AddRelationNewConstraints(), AlterDomainNotNull(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterTableNamespace(), analyze_rel(), ATAddForeignKeyConstraint(), ATExecAddColumn(), ATExecAddConstraint(), ATExecAddIndexConstraint(), ATExecAddInherit(), ATExecAddOf(), ATExecAlterColumnGenericOptions(), ATExecAlterColumnType(), ATExecChangeOwner(), ATExecClusterOn(), ATExecColumnDefault(), ATExecDropColumn(), ATExecDropConstraint(), ATExecDropInherit(), ATExecDropNotNull(), ATExecDropOf(), ATExecGenericOptions(), ATExecSetNotNull(), ATExecSetOptions(), ATExecSetRelOptions(), ATExecSetStatistics(), ATExecSetStorage(), ATExecSetTableSpace(), ATExecValidateConstraint(), ATPrepAlterColumnType(), ATPrepSetStatistics(), ATRewriteTable(), ATRewriteTables(), ATSimplePermissions(), AttrDefaultFetch(), ATTypedTableRecursion(), ATWrongRelkindError(), BeginCopy(), BeginCopyFrom(), BeginCopyTo(), bt_metap(), bt_page_items(), bt_page_stats(), btbuild(), build_row_from_class(), CatalogCacheInitializeCache(), check_exclusion_constraint(), check_for_column_name_collision(), check_index_is_clusterable(), check_object_ownership(), CheckConstraintFetch(), checkFkeyPermissions(), checkInsertTargets(), CheckTableNotInUse(), CheckValidResultRel(), CheckValidRowMarkRel(), closerel(), CommentObject(), comparetup_index_btree(), conversion_error_callback(), copy_heap_data(), CopyFrom(), CopyGetAttnums(), count_nondeletable_pages(), CreateFakeRelcacheEntry(), createForeignKeyTriggers(), CreateTrigger(), currtid_byrelname(), currtid_byreloid(), currval_oid(), DefineIndex(), DefineQueryRewrite(), DefineVirtualRelation(), deparseRelation(), do_analyze_rel(), do_setval(), EnableDisableTrigger(), entryPlaceToPage(), entrySplitPage(), errtable(), ExecConstraints(), ExecOpenScanRelation(), ExecRefreshMatView(), ExecSecLabelStmt(), ExecuteTruncate(), file_acquire_sample_rows(), find_composite_type_dependencies(), fireRIRrules(), generate_relation_name(), generateClonedIndexStmt(), get_actual_variable_range(), get_raw_page_internal(), get_rel_from_relname(), get_relation_by_qualified_name(), GetNewOid(), ginbuild(), GinFormTuple(), ginHeapTupleFastInsert(), ginNewScanKey(), ginVacuumEntryPage(), gistbuild(), gistbulkdelete(), gistcheckpage(), gistdoinsert(), gistFindPath(), gistfixsplit(), gistplacetopage(), gistrescan(), gistUserPicksplit(), hashbuild(), hashgettuple(), heap_get_latest_tid(), heap_lock_tuple(), heap_open(), heap_openrv(), heap_openrv_extended(), index_build(), index_check_primary_key(), index_constraint_create(), index_getprocinfo(), index_open(), IndexBuildHeapScan(), init_sequence(), lastval(), lazy_cleanup_index(), lazy_scan_heap(), lazy_truncate_heap(), lazy_vacuum_heap(), lazy_vacuum_index(), lazy_vacuum_rel(), load_relcache_init_file(), make_inh_translation_list(), MergeAttributes(), MergeAttributesIntoExisting(), MergeConstraintsIntoExisting(), MergeWithExistingConstraint(), nextval_internal(), pg_sequence_parameters(), pgrowlocks(), pgstat_relation(), pgstatginindex(), pgstatindex(), plpgsql_exec_trigger(), pltcl_init_load_unknown(), postgresAcquireSampleRowsFunc(), PrintRelCacheLeakWarning(), process_owned_by(), quoteRelationName(), read_seq_tuple(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationCacheInitializePhase3(), RelationGetBufferForTuple(), RelationGetExclusionInfo(), RelationInitIndexAccessInfo(), RelationInitPhysicalAddr(), RemoveConstraintById(), RemoveTriggerById(), renameatt_internal(), RenameRewriteRule(), renametrig(), report_triggers(), ResourceOwnerForgetRelationRef(), RewriteQuery(), rewriteTargetView(), ri_FetchConstraintInfo(), RI_FKey_check(), RI_Initial_Check(), ri_ReportViolation(), sepgsql_relation_setattr_extra(), spgbuild(), spgdoinsert(), spgGetCache(), spgprocesspending(), SPI_getrelname(), ss_get_location(), ss_report_location(), StoreAttrDefault(), StoreRelCheck(), systable_beginscan_ordered(), toast_fetch_datum(), toast_fetch_datum_slice(), transformFkeyCheckAttrs(), transformFkeyGetPrimaryKey(), transformIndexConstraint(), transformTableLikeClause(), transformUpdateStmt(), triggered_change_notification(), truncate_check_rel(), vacuum_rel(), vacuumLeafPage(), validateDomainConstraint(), visibilitymap_clear(), visibilitymap_set(), visibilitymap_test(), visibilitymap_truncate(), and writeListPage().

#define RelationGetRelid (   relation  )     ((relation)->rd_id)

Definition at line 283 of file rel.h.

Referenced by _hash_has_active_scan(), acquire_inherited_sample_rows(), addRangeTableEntry(), addRangeTableEntryForRelation(), AddRelationNewConstraints(), afterTriggerInvokeEvents(), AfterTriggerSaveEvent(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterSchemaOwner_internal(), AlterSeqNamespaces(), AlterTableNamespaceInternal(), analyze_rel(), ATAddCheckConstraint(), ATAddForeignKeyConstraint(), ATExecAddColumn(), ATExecAddConstraint(), ATExecAddInherit(), ATExecAddOf(), ATExecAlterColumnGenericOptions(), ATExecAlterColumnType(), ATExecCmd(), ATExecColumnDefault(), ATExecDropColumn(), ATExecDropConstraint(), ATExecDropInherit(), ATExecDropNotNull(), ATExecDropOf(), ATExecGenericOptions(), ATExecSetNotNull(), ATExecSetOptions(), ATExecSetRelOptions(), ATExecSetStatistics(), ATExecSetStorage(), ATExecSetTableSpace(), ATExecValidateConstraint(), ATGetQueueEntry(), ATPrepAlterColumnType(), ATPrepSetStatistics(), ATSimplePermissions(), ATSimpleRecursion(), AttrDefaultFetch(), BuildIndexInfo(), BuildIndexValueDescription(), CacheInvalidateHeapTuple(), CacheInvalidateRelcache(), check_for_column_name_collision(), check_index_is_clusterable(), check_object_ownership(), CheckConstraintFetch(), checkFkeyPermissions(), CheckTableNotInUse(), compute_function_hashkey(), create_toast_table(), CreateTrigger(), currtid_byrelname(), currtid_byreloid(), DefineIndex(), deparseAnalyzeSql(), deparseRelation(), do_analyze_rel(), DoCopy(), EnableDisableRule(), EnableDisableTrigger(), errtablecol(), EvalPlanQualFetchRowMarks(), execCurrentOf(), ExecGetTriggerResultRel(), ExecInsertIndexTuples(), ExecLockRows(), ExecuteTruncate(), file_acquire_sample_rows(), fileAnalyzeForeignTable(), fileBeginForeignScan(), fileExplainForeignScan(), fireRIRrules(), ForeignNext(), formrdesc(), generate_relation_name(), generateClonedIndexStmt(), get_catalog_object_by_oid(), get_object_address_attribute(), get_object_address_relobject(), get_pkey_attnames(), get_rel_data_width(), get_rel_from_relname(), get_relation_by_qualified_name(), get_rels_with_domain(), GetFdwRoutineForRelation(), GetTupleForTrigger(), heap_beginscan_internal(), heap_create_with_catalog(), heap_fetch(), heap_lock_tuple(), heap_prepare_insert(), heap_truncate_check_FKs(), heap_update(), index_build(), index_check_primary_key(), index_constraint_create(), index_create(), index_update_stats(), IndexCheckExclusion(), lazy_vacuum_rel(), load_relcache_init_file(), MergeAttributes(), MergeAttributesIntoExisting(), MergeConstraintsIntoExisting(), MergeWithExistingConstraint(), pgrowlocks(), pgstat_report_analyze(), plpython_call_handler(), pltcl_trigger_handler(), postgresAcquireSampleRowsFunc(), postgresAnalyzeForeignTable(), postgresBeginForeignModify(), postgresBeginForeignScan(), PrepareToInvalidateCacheTuple(), process_owned_by(), rebuild_relation(), reindex_relation(), RelationBuildDesc(), RelationBuildLocalRelation(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationCacheInitializePhase3(), RelationCacheInvalidate(), RelationClearRelation(), RelationGetExclusionInfo(), RelationGetIndexList(), RelationInitIndexAccessInfo(), RelationInitLockInfo(), RelationReloadIndexInfo(), RelationSetNewRelfilenode(), RewriteQuery(), ri_FetchConstraintInfo(), RI_Initial_Check(), search_plan_tree(), SetRelationNumChecks(), StoreAttrDefault(), StoreRelCheck(), systable_beginscan_ordered(), TidListCreate(), toast_save_datum(), transformIndexConstraint(), transformTableLikeClause(), truncate_check_rel(), vac_update_relstats(), vacuum_rel(), validateForeignKeyConstraint(), and write_relcache_init_file().

#define RelationGetTargetBlock (   relation  )     ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber )
#define RelationGetTargetPageFreeSpace (   relation,
  defaultff 
)    (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100)
#define RelationGetTargetPageUsage (   relation,
  defaultff 
)    (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100)

Definition at line 234 of file rel.h.

Referenced by _hash_metapinit().

#define RelationHasReferenceCountZero (   relation  )     ((bool)((relation)->rd_refcnt == 0))
#define RelationIsMapped (   relation  )     ((relation)->rd_rel->relfilenode == InvalidOid)
#define RelationIsScannable (   relation  )     ((relation)->rd_ispopulated)

Definition at line 411 of file rel.h.

Referenced by ExecOpenScanRelation(), and pg_relation_is_scannable().

#define RelationIsSecurityView (   relation  ) 
Value:
((relation)->rd_options ?               \
     ((StdRdOptions *) (relation)->rd_options)->security_barrier : false)

Definition at line 248 of file rel.h.

Referenced by ApplyRetrieveRule(), and view_is_auto_updatable().

#define RelationIsValid (   relation  )     PointerIsValid(relation)
#define RelationNeedsWAL (   relation  )     ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
#define RelationOpenSmgr (   relation  ) 
#define RelationSetTargetBlock (   relation,
  targblock 
)
Value:
do { \
        RelationOpenSmgr(relation); \
        (relation)->rd_smgr->smgr_targblock = (targblock); \
    } while (0)

Definition at line 362 of file rel.h.

Referenced by fill_seq_with_data(), and RelationGetBufferForTuple().

#define RelationUsesLocalBuffers (   relation  )     ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP)

Typedef Documentation

typedef struct AutoVacOpts AutoVacOpts

Definition at line 46 of file rel.h.

typedef struct LockInfoData LockInfoData
typedef struct LockRelId LockRelId
typedef struct RelationData RelationData
typedef struct StdRdOptions StdRdOptions

Function Documentation

void RelationDecrementReferenceCount ( Relation  rel  ) 
void RelationIncrementReferenceCount ( Relation  rel  )