PostgreSQL Source Code  git master
table.h File Reference
#include "nodes/primnodes.h"
#include "utils/relcache.h"
#include "storage/lockdefs.h"
Include dependency graph for table.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define heap_open(r, l)   table_open(r, l)
 
#define heap_openrv(r, l)   table_openrv(r, l)
 
#define heap_openrv_extended(r, l, m)   table_openrv_extended(r, l, m)
 
#define heap_close(r, l)   table_close(r, l)
 

Functions

Relation table_open (Oid relationId, LOCKMODE lockmode)
 
Relation table_openrv (const RangeVar *relation, LOCKMODE lockmode)
 
Relation table_openrv_extended (const RangeVar *relation, LOCKMODE lockmode, bool missing_ok)
 
void table_close (Relation relation, LOCKMODE lockmode)
 

Macro Definition Documentation

◆ heap_close

#define heap_close (   r,
 
)    table_close(r, l)

Definition at line 36 of file table.h.

Referenced by has_stored_generated_columns(), and UpdateStatisticsForTypeChange().

◆ heap_open

#define heap_open (   r,
 
)    table_open(r, l)

Definition at line 33 of file table.h.

Referenced by has_stored_generated_columns(), and UpdateStatisticsForTypeChange().

◆ heap_openrv

#define heap_openrv (   r,
 
)    table_openrv(r, l)

Definition at line 34 of file table.h.

◆ heap_openrv_extended

#define heap_openrv_extended (   r,
  l,
 
)    table_openrv_extended(r, l, m)

Definition at line 35 of file table.h.

Function Documentation

◆ table_close()

void table_close ( Relation  relation,
LOCKMODE  lockmode 
)

Definition at line 133 of file table.c.

References relation_close().

Referenced by _bt_parallel_build_main(), acquire_inherited_sample_rows(), AcquireRewriteLocks(), AddEnumLabel(), addFkRecurseReferenced(), addFkRecurseReferencing(), AddNewAttributeTuples(), addRangeTableEntry(), AddRoleMems(), AddSubscriptionRelState(), AfterTriggerSetState(), AggregateCreate(), AlterCollation(), AlterConstraintNamespaces(), AlterDatabase(), AlterDatabaseOwner(), AlterDomainAddConstraint(), AlterDomainDefault(), AlterDomainDropConstraint(), AlterDomainNotNull(), AlterDomainValidateConstraint(), AlterEventTrigger(), AlterEventTriggerOwner(), AlterEventTriggerOwner_oid(), AlterExtensionNamespace(), AlterForeignDataWrapper(), AlterForeignDataWrapperOwner(), AlterForeignDataWrapperOwner_oid(), AlterForeignServer(), AlterForeignServerOwner(), AlterForeignServerOwner_oid(), AlterFunction(), AlterObjectNamespace_oid(), AlterOperator(), AlterPolicy(), AlterPublication(), AlterPublicationOwner(), AlterPublicationOwner_oid(), AlterRole(), AlterSchemaOwner(), AlterSchemaOwner_oid(), AlterSequence(), AlterSetting(), AlterStatistics(), AlterSubscription(), AlterSubscriptionOwner(), AlterSubscriptionOwner_oid(), AlterTableMoveAll(), AlterTableNamespaceInternal(), AlterTableSpaceOptions(), AlterTSConfiguration(), AlterTSDictionary(), AlterTypeNamespaceInternal(), AlterTypeOwner(), AlterTypeOwner_oid(), AlterTypeOwnerInternal(), AlterUserMapping(), AppendAttributeTuples(), ApplyExtensionUpdates(), AssignTypeArrayOid(), ATAddCheckConstraint(), ATAddForeignKeyConstraint(), ATCheckPartitionsNotInUse(), ATDetachCheckNoForeignKeyRefs(), ATExecAddColumn(), ATExecAddIdentity(), ATExecAddInherit(), ATExecAddOf(), ATExecAlterColumnGenericOptions(), ATExecAlterColumnType(), ATExecAlterConstraint(), ATExecAttachPartition(), ATExecChangeOwner(), ATExecDetachPartition(), ATExecDisableRowSecurity(), ATExecDropColumn(), ATExecDropConstraint(), ATExecDropIdentity(), ATExecDropInherit(), ATExecDropNotNull(), ATExecDropOf(), ATExecEnableRowSecurity(), ATExecForceNoForceRowSecurity(), ATExecGenericOptions(), ATExecSetIdentity(), ATExecSetNotNull(), ATExecSetOptions(), ATExecSetRelOptions(), ATExecSetStatistics(), ATExecSetStorage(), ATExecSetTableSpace(), ATExecSetTableSpaceNoStorage(), ATExecValidateConstraint(), ATPrepChangePersistence(), ATRewriteTable(), ATRewriteTables(), AttrDefaultFetch(), boot_openrel(), BootstrapToastTable(), bringetbitmap(), brinvacuumcleanup(), bt_index_check_internal(), build_indices(), build_physical_tlist(), BuildRelationExtStatistics(), CatalogCacheInitializeCache(), change_owner_fix_column_acls(), changeDependenciesOf(), changeDependenciesOn(), changeDependencyFor(), changeDependencyOnOwner(), check_db_file_conflict(), check_default_partition_contents(), check_selective_binary_conversion(), CheckAndCreateToastTable(), CheckConstraintFetch(), checkSharedDependencies(), ChooseConstraintName(), CloneFkReferenced(), CloneFkReferencing(), CloneRowTriggersToPartition(), close_lo_relation(), closerel(), CloseTableList(), cluster(), CollationCreate(), ComputeExtStatisticsRows(), ConstraintNameExists(), ConstraintNameIsUsed(), ConstraintSetParentConstraint(), ConversionCreate(), copy_table_data(), copyTemplateDependencies(), CountDBSubscriptions(), create_proc_lang(), create_toast_table(), CreateAccessMethod(), CreateCast(), CreateComments(), CreateConstraintEntry(), createdb(), CreateForeignDataWrapper(), CreateForeignServer(), CreateForeignTable(), CreateInheritance(), CreateOpFamily(), CreatePolicy(), CreatePublication(), CreateRole(), CreateSharedComments(), CreateSubscription(), CreateTableSpace(), CreateTransform(), CreateTrigger(), CreateUserMapping(), currtid_byrelname(), currtid_byreloid(), currtid_for_view(), database_to_xmlschema_internal(), DefineIndex(), DefineOpClass(), DefineQueryRewrite(), DefineRelation(), DefineSequence(), DefineTSConfiguration(), DefineTSDictionary(), DefineTSParser(), DefineTSTemplate(), DeleteAttributeTuples(), DeleteComments(), deleteDependencyRecordsFor(), deleteDependencyRecordsForClass(), DeleteInheritsTuple(), DeleteInitPrivs(), deleteOneObject(), DeleteRelationTuple(), DeleteSecurityLabel(), DeleteSequenceTuple(), DeleteSharedComments(), deleteSharedDependencyRecordsFor(), DeleteSharedSecurityLabel(), DeleteSystemAttributeTuples(), DelRoleMems(), deparseColumnRef(), deparseFromExprForRel(), deparseSelectSql(), do_autovacuum(), DoCopy(), drop_parent_dependency(), DropCastById(), dropDatabaseDependencies(), dropdb(), DropProceduralLanguageById(), DropRole(), DropSetting(), DropSubscription(), DropTableSpace(), DropTransformById(), EnableDisableRule(), EnableDisableTrigger(), ENRMetadataGetTupDesc(), enum_endpoint(), enum_range_internal(), EnumValuesCreate(), EnumValuesDelete(), EventTriggerSQLDropAddObject(), exec_object_restorecon(), ExecAlterExtensionStmt(), ExecAlterObjectDependsStmt(), ExecAlterObjectSchemaStmt(), ExecAlterOwnerStmt(), ExecCleanUpTriggerState(), ExecCleanupTupleRouting(), ExecEndPlan(), ExecGrant_Database(), ExecGrant_Fdw(), ExecGrant_ForeignServer(), ExecGrant_Function(), ExecGrant_Language(), ExecGrant_Largeobject(), ExecGrant_Namespace(), ExecGrant_Relation(), ExecGrant_Tablespace(), ExecGrant_Type(), ExecRefreshMatView(), ExecRenameStmt(), ExecuteTruncate(), ExecuteTruncateGuts(), expand_inherited_rtentry(), expand_partitioned_rtentry(), extension_config_remove(), find_inheritance_children(), find_language_template(), find_typed_table_dependencies(), finish_heap_swap(), fireRIRrules(), free_parsestate(), get_actual_variable_range(), get_all_vacuum_rels(), get_constraint_index(), get_database_list(), get_database_oid(), get_db_info(), get_domain_constraint_oid(), get_extension_name(), get_extension_oid(), get_extension_schema(), get_file_fdw_attribute_options(), get_index_constraint(), get_index_ref_constraints(), get_object_address_relobject(), get_partition_ancestors(), get_partition_parent(), get_pkey_attnames(), get_primary_key_attnos(), get_relation_constraint_attnos(), get_relation_constraint_oid(), get_relation_constraints(), get_relation_data_width(), get_relation_idx_constraint_oid(), get_relation_info(), get_relation_policy_oid(), get_row_security_policies(), get_subscription_list(), get_tablespace_name(), get_tablespace_oid(), get_trigger_oid(), GetAllTablesPublicationRelations(), GetAllTablesPublications(), GetComment(), getConstraintTypeDescription(), GetDatabaseTuple(), GetDatabaseTupleByOid(), GetDefaultOpClass(), getExtensionOfObject(), getObjectDescription(), getObjectIdentityParts(), getOwnedSequences_internal(), GetParentedForeignKeyRefs(), GetPublicationRelations(), getRelationsInNamespace(), GetSecurityLabel(), GetSharedSecurityLabel(), GetSubscriptionNotReadyRelations(), GetSubscriptionRelations(), GetSubscriptionRelState(), gettype(), GrantRole(), has_row_triggers(), has_superclass(), heap_create_with_catalog(), heap_drop_with_catalog(), heap_sync(), heap_truncate(), heap_truncate_find_FKs(), heap_truncate_one_rel(), index_build(), index_concurrently_build(), index_concurrently_set_dead(), index_concurrently_swap(), index_constraint_create(), index_create(), index_drop(), index_set_state_flags(), index_update_stats(), infer_arbiter_indexes(), insert_event_trigger_tuple(), InsertExtensionTuple(), InsertRule(), intorel_shutdown(), isQueryUsingTempRelation_walker(), LargeObjectCreate(), LargeObjectDrop(), LargeObjectExists(), load_domaintype_info(), load_enum_cache_data(), LockViewRecurse(), logicalrep_rel_close(), LogicalRepSyncTableStart(), lookup_ts_config_cache(), LookupOpclassInfo(), make_new_heap(), make_ruledef(), make_viewdef(), makeArrayTypeName(), mark_index_clustered(), MergeAttributes(), MergeAttributesIntoExisting(), MergeConstraintsIntoExisting(), MergeWithExistingConstraint(), movedb(), myLargeObjectExists(), NamespaceCreate(), objectsInSchemaToOids(), OpenTableList(), OperatorCreate(), OperatorShellMake(), OperatorUpd(), performDeletion(), performMultipleDeletions(), pg_event_trigger_ddl_commands(), pg_extension_config_dump(), pg_extension_ownercheck(), pg_get_constraintdef_worker(), pg_get_replica_identity_index(), pg_get_serial_sequence(), pg_get_triggerdef_worker(), pg_identify_object(), pg_largeobject_aclmask_snapshot(), pg_largeobject_ownercheck(), pg_nextoid(), pgrowlocks(), pgstat_collect_oids(), plan_create_index_workers(), postgresPlanDirectModify(), postgresPlanForeignModify(), preprocess_targetlist(), ProcedureCreate(), process_settings(), publication_add_relation(), QueuePartitionConstraintValidation(), RangeCreate(), RangeDelete(), rebuild_relation(), recordExtensionInitPrivWorker(), recordMultipleDependencies(), recordSharedDependencyOn(), refresh_by_match_merge(), reindex_index(), reindex_relation(), ReindexMultipleTables(), ReindexRelationConcurrently(), relation_has_policies(), relation_mark_replica_identity(), RelationBuildPartitionDesc(), RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationClearMissing(), RelationGetExclusionInfo(), RelationGetFKeyList(), RelationGetIndexList(), RelationGetStatExtList(), RelationRemoveInheritance(), RelationSetNewRelfilenode(), RelidByRelfilenode(), remove_dbtablespaces(), RemoveAccessMethodById(), RemoveAmOpEntryById(), RemoveAmProcEntryById(), RemoveAttrDefault(), RemoveAttrDefaultById(), RemoveAttributeById(), RemoveCollationById(), RemoveConstraintById(), RemoveConversionById(), RemoveDefaultACLById(), RemoveEventTriggerById(), RemoveExtensionById(), RemoveForeignDataWrapperById(), RemoveForeignServerById(), RemoveFunctionById(), RemoveInheritance(), RemoveObjects(), RemoveOpClassById(), RemoveOperatorById(), RemoveOpFamilyById(), RemovePartitionKeyByRelId(), RemovePolicyById(), RemovePublicationById(), RemovePublicationRelById(), RemoveRewriteRuleById(), RemoveRoleFromObjectACL(), RemoveRoleFromObjectPolicy(), RemoveSchemaById(), RemoveStatistics(), RemoveStatisticsById(), RemoveSubscriptionRel(), RemoveTriggerById(), RemoveTSConfigurationById(), RemoveTSDictionaryById(), RemoveTSParserById(), RemoveTSTemplateById(), RemoveTypeById(), RemoveUserMappingById(), rename_policy(), renameatt_internal(), RenameConstraint(), RenameConstraintById(), RenameDatabase(), RenameEnumLabel(), RenameRelationInternal(), RenameRewriteRule(), RenameRole(), RenameSchema(), RenameTableSpace(), renametrig(), RenameType(), RenameTypeInternal(), replorigin_create(), replorigin_drop(), RewriteQuery(), rewriteTargetView(), RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), ri_restrict(), ri_set(), ScanPgRelation(), schema_to_xmlschema_internal(), SearchCatCacheList(), SearchCatCacheMiss(), sepgsql_attribute_post_create(), sepgsql_database_post_create(), sepgsql_index_modify(), sepgsql_proc_post_create(), sepgsql_proc_setattr(), sepgsql_relation_post_create(), sepgsql_relation_setattr(), sepgsql_schema_post_create(), sequenceIsOwned(), SetAttrMissing(), SetDefaultACL(), SetFunctionArgType(), SetFunctionReturnType(), SetMatViewPopulatedState(), SetRelationHasSubclass(), SetRelationNumChecks(), SetRelationRuleStatus(), SetSecurityLabel(), SetSharedSecurityLabel(), setTargetTable(), shdepDropOwned(), shdepReassignOwned(), statext_store(), StoreAttrDefault(), StoreCatalogInheritance(), storeOperators(), StorePartitionBound(), StorePartitionKey(), storeProcedures(), StoreSingleInheritance(), swap_relation_files(), table_to_xml_and_xmlschema(), table_to_xmlschema(), ThereIsAtLeastOneRole(), toast_delete_datum(), toast_fetch_datum(), toast_fetch_datum_slice(), toast_get_valid_index(), toast_save_datum(), toastid_valueid_exists(), transformIndexConstraint(), transformIndexStmt(), transformRuleStmt(), transformTableLikeClause(), transientrel_shutdown(), tryAttachPartitionForeignKey(), TypeCreate(), typeInheritsFrom(), TypeShellMake(), update_attstats(), update_default_partition_oid(), update_relispartition(), updateAclDependencies(), UpdateIndexRelation(), UpdateSubscriptionRelState(), vac_truncate_clog(), vac_update_datfrozenxid(), vac_update_relstats(), validate_index(), validateDomainConstraint(), and validatePartitionedIndex().

134 {
135  relation_close(relation, lockmode);
136 }
void relation_close(Relation relation, LOCKMODE lockmode)
Definition: relation.c:206

◆ table_open()

Relation table_open ( Oid  relationId,
LOCKMODE  lockmode 
)

Definition at line 39 of file table.c.

References ereport, errcode(), errmsg(), ERROR, RelationData::rd_rel, relation_open(), and RelationGetRelationName.

Referenced by _bt_parallel_build_main(), acquire_inherited_sample_rows(), AcquireRewriteLocks(), AddEnumLabel(), addFkRecurseReferenced(), addFkRecurseReferencing(), AddNewAttributeTuples(), AddRoleMems(), AddSubscriptionRelState(), AfterTriggerSetState(), AggregateCreate(), AlterCollation(), AlterConstraintNamespaces(), AlterDatabase(), AlterDatabaseOwner(), AlterDomainAddConstraint(), AlterDomainDefault(), AlterDomainDropConstraint(), AlterDomainNotNull(), AlterDomainValidateConstraint(), AlterEventTrigger(), AlterEventTriggerOwner(), AlterEventTriggerOwner_oid(), AlterExtensionNamespace(), AlterForeignDataWrapper(), AlterForeignDataWrapperOwner(), AlterForeignDataWrapperOwner_oid(), AlterForeignServer(), AlterForeignServerOwner(), AlterForeignServerOwner_oid(), AlterFunction(), AlterObjectNamespace_oid(), AlterOperator(), AlterPolicy(), AlterPublication(), AlterPublicationOwner(), AlterPublicationOwner_oid(), AlterPublicationTables(), AlterRole(), AlterSchemaOwner(), AlterSchemaOwner_oid(), AlterSeqNamespaces(), AlterSequence(), AlterSetting(), AlterStatistics(), AlterSubscription(), AlterSubscriptionOwner(), AlterSubscriptionOwner_oid(), AlterTableMoveAll(), AlterTableNamespaceInternal(), AlterTableSpaceOptions(), AlterTSConfiguration(), AlterTSDictionary(), AlterTypeNamespaceInternal(), AlterTypeOwner(), AlterTypeOwner_oid(), AlterTypeOwnerInternal(), AlterUserMapping(), AppendAttributeTuples(), ApplyExtensionUpdates(), AssignTypeArrayOid(), ATAddCheckConstraint(), ATAddForeignKeyConstraint(), ATCheckPartitionsNotInUse(), ATDetachCheckNoForeignKeyRefs(), ATExecAddColumn(), ATExecAddIdentity(), ATExecAddOf(), ATExecAlterColumnGenericOptions(), ATExecAlterColumnType(), ATExecAlterConstraint(), ATExecAttachPartition(), ATExecChangeOwner(), ATExecDetachPartition(), ATExecDisableRowSecurity(), ATExecDropColumn(), ATExecDropConstraint(), ATExecDropIdentity(), ATExecDropNotNull(), ATExecDropOf(), ATExecEnableRowSecurity(), ATExecForceNoForceRowSecurity(), ATExecGenericOptions(), ATExecSetIdentity(), ATExecSetNotNull(), ATExecSetOptions(), ATExecSetRelOptions(), ATExecSetStatistics(), ATExecSetStorage(), ATExecSetTableSpace(), ATExecSetTableSpaceNoStorage(), ATExecValidateConstraint(), ATPrepChangePersistence(), ATRewriteTable(), ATRewriteTables(), AttrDefaultFetch(), boot_openrel(), brin_desummarize_range(), brin_summarize_range(), bringetbitmap(), brinvacuumcleanup(), bt_index_check_internal(), build_indices(), build_physical_tlist(), BuildRelationExtStatistics(), CatalogCacheInitializeCache(), change_owner_fix_column_acls(), change_owner_recurse_to_sequences(), changeDependenciesOf(), changeDependenciesOn(), changeDependencyFor(), changeDependencyOnOwner(), check_db_file_conflict(), check_default_partition_contents(), check_selective_binary_conversion(), CheckAndCreateToastTable(), CheckConstraintFetch(), checkSharedDependencies(), ChooseConstraintName(), CloneFkReferenced(), CloneFkReferencing(), CloneRowTriggersToPartition(), cluster(), CollationCreate(), ComputeExtStatisticsRows(), ConstraintNameExists(), ConstraintNameIsUsed(), ConstraintSetParentConstraint(), ConversionCreate(), copy_table_data(), copyTemplateDependencies(), CountDBSubscriptions(), create_proc_lang(), create_toast_table(), CreateAccessMethod(), CreateCast(), CreateComments(), CreateConstraintEntry(), createdb(), CreateForeignDataWrapper(), CreateForeignServer(), CreateForeignTable(), CreateInheritance(), CreateOpFamily(), CreatePolicy(), CreatePublication(), CreateRole(), CreateSharedComments(), CreateStatistics(), CreateSubscription(), CreateTableSpace(), CreateTransform(), CreateTrigger(), CreateUserMapping(), currtid_byreloid(), database_to_xmlschema_internal(), DefineIndex(), DefineOpClass(), DefineQueryRewrite(), DefineRelation(), DefineSequence(), DefineTSConfiguration(), DefineTSDictionary(), DefineTSParser(), DefineTSTemplate(), DeleteAttributeTuples(), DeleteComments(), deleteDependencyRecordsFor(), deleteDependencyRecordsForClass(), DeleteInheritsTuple(), DeleteInitPrivs(), deleteOneObject(), DeleteRelationTuple(), DeleteSecurityLabel(), DeleteSequenceTuple(), DeleteSharedComments(), deleteSharedDependencyRecordsFor(), DeleteSharedSecurityLabel(), DeleteSystemAttributeTuples(), DelRoleMems(), deparseColumnRef(), deparseFromExprForRel(), deparseSelectSql(), do_autovacuum(), drop_parent_dependency(), DropCastById(), dropDatabaseDependencies(), dropdb(), DropProceduralLanguageById(), DropRole(), DropSetting(), DropSubscription(), DropTableSpace(), DropTransformById(), EnableDisableRule(), EnableDisableTrigger(), ENRMetadataGetTupDesc(), enum_endpoint(), enum_range_internal(), EnumValuesCreate(), EnumValuesDelete(), EventTriggerSQLDropAddObject(), exec_object_restorecon(), ExecAlterExtensionStmt(), ExecAlterObjectSchemaStmt(), ExecAlterOwnerStmt(), ExecGetRangeTableRelation(), ExecGetTriggerResultRel(), ExecGrant_Database(), ExecGrant_Fdw(), ExecGrant_ForeignServer(), ExecGrant_Function(), ExecGrant_Language(), ExecGrant_Largeobject(), ExecGrant_Namespace(), ExecGrant_Relation(), ExecGrant_Tablespace(), ExecGrant_Type(), ExecInitPartitionDispatchInfo(), ExecInitPartitionInfo(), ExecRefreshMatView(), ExecRenameStmt(), ExecuteTruncate(), ExecuteTruncateGuts(), expand_inherited_rtentry(), expand_partitioned_rtentry(), extension_config_remove(), find_composite_type_dependencies(), find_inheritance_children(), find_language_template(), find_typed_table_dependencies(), finish_heap_swap(), fireRIRrules(), get_actual_variable_range(), get_all_vacuum_rels(), get_constraint_index(), get_database_list(), get_database_oid(), get_db_info(), get_domain_constraint_oid(), get_extension_name(), get_extension_oid(), get_extension_schema(), get_file_fdw_attribute_options(), get_index_constraint(), get_index_ref_constraints(), get_partition_ancestors(), get_partition_parent(), get_pkey_attnames(), get_primary_key_attnos(), get_relation_constraint_attnos(), get_relation_constraint_oid(), get_relation_constraints(), get_relation_data_width(), get_relation_idx_constraint_oid(), get_relation_info(), get_relation_policy_oid(), get_rels_with_domain(), get_row_security_policies(), get_subscription_list(), get_tables_to_cluster(), get_tablespace_name(), get_tablespace_oid(), get_trigger_oid(), GetAllTablesPublicationRelations(), GetAllTablesPublications(), GetComment(), getConstraintTypeDescription(), GetDatabaseTuple(), GetDatabaseTupleByOid(), GetDefaultOpClass(), getExtensionOfObject(), getObjectDescription(), getObjectIdentityParts(), getOwnedSequences_internal(), GetParentedForeignKeyRefs(), GetPublicationRelations(), getRelationsInNamespace(), GetSecurityLabel(), GetSharedSecurityLabel(), GetSubscriptionNotReadyRelations(), GetSubscriptionRelations(), GetSubscriptionRelState(), gettype(), GrantRole(), has_row_triggers(), has_superclass(), heap_create_with_catalog(), heap_drop_with_catalog(), heap_sync(), heap_truncate(), heap_truncate_find_FKs(), heap_truncate_one_rel(), index_build(), index_concurrently_build(), index_concurrently_set_dead(), index_concurrently_swap(), index_constraint_create(), index_create(), index_drop(), index_set_state_flags(), index_update_stats(), infer_arbiter_indexes(), insert_event_trigger_tuple(), InsertExtensionTuple(), InsertRule(), intorel_startup(), isQueryUsingTempRelation_walker(), LargeObjectCreate(), LargeObjectDrop(), LargeObjectExists(), load_domaintype_info(), load_enum_cache_data(), LockViewRecurse(), logicalrep_rel_open(), LogicalRepSyncTableStart(), lookup_ts_config_cache(), LookupOpclassInfo(), make_new_heap(), make_ruledef(), make_viewdef(), makeArrayTypeName(), mark_index_clustered(), MergeAttributes(), MergeAttributesIntoExisting(), MergeConstraintsIntoExisting(), MergeWithExistingConstraint(), movedb(), myLargeObjectExists(), NamespaceCreate(), objectsInSchemaToOids(), open_lo_relation(), OpenTableList(), OperatorCreate(), OperatorShellMake(), OperatorUpd(), performDeletion(), performMultipleDeletions(), pg_event_trigger_ddl_commands(), pg_extension_config_dump(), pg_extension_ownercheck(), pg_get_constraintdef_worker(), pg_get_replica_identity_index(), pg_get_serial_sequence(), pg_get_triggerdef_worker(), pg_identify_object(), pg_largeobject_aclmask_snapshot(), pg_largeobject_ownercheck(), pg_nextoid(), pgstat_collect_oids(), plan_create_index_workers(), postgresPlanDirectModify(), postgresPlanForeignModify(), preprocess_targetlist(), ProcedureCreate(), process_settings(), publication_add_relation(), QueuePartitionConstraintValidation(), RangeCreate(), RangeDelete(), recordExtensionInitPrivWorker(), recordExtObjInitPriv(), recordMultipleDependencies(), recordSharedDependencyOn(), refresh_by_match_merge(), reindex_index(), reindex_relation(), ReindexMultipleTables(), ReindexRelationConcurrently(), relation_has_policies(), relation_mark_replica_identity(), RelationBuildPartitionDesc(), RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationClearMissing(), RelationGetExclusionInfo(), RelationGetFKeyList(), RelationGetIndexList(), RelationGetStatExtList(), RelationRemoveInheritance(), RelationSetNewRelfilenode(), RelidByRelfilenode(), remove_dbtablespaces(), RemoveAccessMethodById(), RemoveAmOpEntryById(), RemoveAmProcEntryById(), RemoveAttrDefault(), RemoveAttrDefaultById(), RemoveAttributeById(), RemoveCollationById(), RemoveConstraintById(), RemoveConversionById(), RemoveDefaultACLById(), RemoveEventTriggerById(), RemoveExtensionById(), RemoveForeignDataWrapperById(), RemoveForeignServerById(), RemoveFunctionById(), RemoveInheritance(), RemoveOpClassById(), RemoveOperatorById(), RemoveOpFamilyById(), RemovePartitionKeyByRelId(), RemovePolicyById(), RemovePublicationById(), RemovePublicationRelById(), RemoveRewriteRuleById(), RemoveRoleFromObjectACL(), RemoveRoleFromObjectPolicy(), RemoveSchemaById(), RemoveStatistics(), RemoveStatisticsById(), RemoveSubscriptionRel(), RemoveTriggerById(), RemoveTSConfigurationById(), RemoveTSDictionaryById(), RemoveTSParserById(), RemoveTSTemplateById(), RemoveTypeById(), RemoveUserMappingById(), rename_policy(), renameatt_internal(), RenameConstraint(), RenameConstraintById(), RenameDatabase(), RenameEnumLabel(), RenameRelationInternal(), RenameRewriteRule(), RenameRole(), RenameSchema(), RenameTableSpace(), renametrig(), RenameType(), RenameTypeInternal(), replorigin_create(), replorigin_drop(), RewriteQuery(), rewriteTargetView(), RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), ri_restrict(), ri_set(), ScanPgRelation(), schema_to_xmlschema_internal(), SearchCatCacheList(), SearchCatCacheMiss(), sepgsql_attribute_post_create(), sepgsql_database_post_create(), sepgsql_index_modify(), sepgsql_proc_post_create(), sepgsql_proc_setattr(), sepgsql_relation_post_create(), sepgsql_relation_setattr(), sepgsql_schema_post_create(), sequenceIsOwned(), SetAttrMissing(), SetDefaultACL(), SetFunctionArgType(), SetFunctionReturnType(), SetMatViewPopulatedState(), SetRelationHasSubclass(), SetRelationNumChecks(), SetRelationRuleStatus(), SetSecurityLabel(), SetSharedSecurityLabel(), shdepDropOwned(), shdepReassignOwned(), statext_store(), StoreAttrDefault(), StoreCatalogInheritance(), storeOperators(), StorePartitionBound(), StorePartitionKey(), storeProcedures(), StoreSingleInheritance(), swap_relation_files(), table_to_xml_and_xmlschema(), table_to_xmlschema(), ThereIsAtLeastOneRole(), toast_delete_datum(), toast_fetch_datum(), toast_fetch_datum_slice(), toast_get_valid_index(), toast_save_datum(), toastid_valueid_exists(), transientrel_startup(), tryAttachPartitionForeignKey(), TypeCreate(), typeInheritsFrom(), TypeShellMake(), update_attstats(), update_default_partition_oid(), update_relispartition(), updateAclDependencies(), UpdateIndexRelation(), UpdateSubscriptionRelState(), vac_truncate_clog(), vac_update_datfrozenxid(), vac_update_relstats(), validate_index(), and validatePartitionedIndex().

40 {
41  Relation r;
42 
43  r = relation_open(relationId, lockmode);
44 
45  if (r->rd_rel->relkind == RELKIND_INDEX ||
46  r->rd_rel->relkind == RELKIND_PARTITIONED_INDEX)
47  ereport(ERROR,
48  (errcode(ERRCODE_WRONG_OBJECT_TYPE),
49  errmsg("\"%s\" is an index",
51  else if (r->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
52  ereport(ERROR,
53  (errcode(ERRCODE_WRONG_OBJECT_TYPE),
54  errmsg("\"%s\" is a composite type",
56 
57  return r;
58 }
int errcode(int sqlerrcode)
Definition: elog.c:570
Form_pg_class rd_rel
Definition: rel.h:83
#define ERROR
Definition: elog.h:43
Relation relation_open(Oid relationId, LOCKMODE lockmode)
Definition: relation.c:48
#define RelationGetRelationName(relation)
Definition: rel.h:450
#define ereport(elevel, rest)
Definition: elog.h:141
int errmsg(const char *fmt,...)
Definition: elog.c:784

◆ table_openrv()

Relation table_openrv ( const RangeVar relation,
LOCKMODE  lockmode 
)

Definition at line 68 of file table.c.

References ereport, errcode(), errmsg(), ERROR, RelationData::rd_rel, relation_openrv(), and RelationGetRelationName.

Referenced by ATAddForeignKeyConstraint(), ATExecAddInherit(), ATExecAttachPartition(), ATExecDetachPartition(), ATExecDropInherit(), boot_openrel(), BootstrapToastTable(), CreateTrigger(), currtid_byrelname(), DoCopy(), get_rel_from_relname(), OpenTableList(), transformIndexConstraint(), and transformRuleStmt().

69 {
70  Relation r;
71 
72  r = relation_openrv(relation, lockmode);
73 
74  if (r->rd_rel->relkind == RELKIND_INDEX ||
75  r->rd_rel->relkind == RELKIND_PARTITIONED_INDEX)
76  ereport(ERROR,
77  (errcode(ERRCODE_WRONG_OBJECT_TYPE),
78  errmsg("\"%s\" is an index",
80  else if (r->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
81  ereport(ERROR,
82  (errcode(ERRCODE_WRONG_OBJECT_TYPE),
83  errmsg("\"%s\" is a composite type",
85 
86  return r;
87 }
int errcode(int sqlerrcode)
Definition: elog.c:570
Form_pg_class rd_rel
Definition: rel.h:83
#define ERROR
Definition: elog.h:43
#define RelationGetRelationName(relation)
Definition: rel.h:450
#define ereport(elevel, rest)
Definition: elog.h:141
Relation relation_openrv(const RangeVar *relation, LOCKMODE lockmode)
Definition: relation.c:138
int errmsg(const char *fmt,...)
Definition: elog.c:784

◆ table_openrv_extended()

Relation table_openrv_extended ( const RangeVar relation,
LOCKMODE  lockmode,
bool  missing_ok 
)

Definition at line 98 of file table.c.

References ereport, errcode(), errmsg(), ERROR, RelationData::rd_rel, relation_openrv_extended(), and RelationGetRelationName.

Referenced by get_object_address_relobject(), and parserOpenTable().

100 {
101  Relation r;
102 
103  r = relation_openrv_extended(relation, lockmode, missing_ok);
104 
105  if (r)
106  {
107  if (r->rd_rel->relkind == RELKIND_INDEX ||
108  r->rd_rel->relkind == RELKIND_PARTITIONED_INDEX)
109  ereport(ERROR,
110  (errcode(ERRCODE_WRONG_OBJECT_TYPE),
111  errmsg("\"%s\" is an index",
113  else if (r->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
114  ereport(ERROR,
115  (errcode(ERRCODE_WRONG_OBJECT_TYPE),
116  errmsg("\"%s\" is a composite type",
118  }
119 
120  return r;
121 }
int errcode(int sqlerrcode)
Definition: elog.c:570
Form_pg_class rd_rel
Definition: rel.h:83
#define ERROR
Definition: elog.h:43
#define RelationGetRelationName(relation)
Definition: rel.h:450
#define ereport(elevel, rest)
Definition: elog.h:141
int errmsg(const char *fmt,...)
Definition: elog.c:784
Relation relation_openrv_extended(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok)
Definition: relation.c:173