PostgreSQL Source Code git master
Loading...
Searching...
No Matches
indexing.h File Reference
#include "access/htup.h"
#include "executor/tuptable.h"
#include "utils/relcache.h"
Include dependency graph for indexing.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAX_CATALOG_MULTI_INSERT_BYTES   65535
 

Typedefs

typedef struct ResultRelInfo * CatalogIndexState
 

Functions

CatalogIndexState CatalogOpenIndexes (Relation heapRel)
 
void CatalogCloseIndexes (CatalogIndexState indstate)
 
void CatalogTupleInsert (Relation heapRel, HeapTuple tup)
 
void CatalogTupleInsertWithInfo (Relation heapRel, HeapTuple tup, CatalogIndexState indstate)
 
void CatalogTuplesMultiInsertWithInfo (Relation heapRel, TupleTableSlot **slot, int ntuples, CatalogIndexState indstate)
 
void CatalogTupleUpdate (Relation heapRel, const ItemPointerData *otid, HeapTuple tup)
 
void CatalogTupleUpdateWithInfo (Relation heapRel, const ItemPointerData *otid, HeapTuple tup, CatalogIndexState indstate)
 
void CatalogTupleDelete (Relation heapRel, const ItemPointerData *tid)
 

Macro Definition Documentation

◆ MAX_CATALOG_MULTI_INSERT_BYTES

#define MAX_CATALOG_MULTI_INSERT_BYTES   65535

Definition at line 33 of file indexing.h.

Typedef Documentation

◆ CatalogIndexState

Definition at line 27 of file indexing.h.

Function Documentation

◆ CatalogCloseIndexes()

◆ CatalogOpenIndexes()

CatalogIndexState CatalogOpenIndexes ( Relation  heapRel)
extern

Definition at line 43 of file indexing.c.

44{
45 ResultRelInfo *resultRelInfo;
46
47 resultRelInfo = makeNode(ResultRelInfo);
48 resultRelInfo->ri_RangeTableIndex = 0; /* dummy */
49 resultRelInfo->ri_RelationDesc = heapRel;
50 resultRelInfo->ri_TrigDesc = NULL; /* we don't fire triggers */
51
52 ExecOpenIndices(resultRelInfo, false);
53
54 return resultRelInfo;
55}
void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative)
#define makeNode(_type_)
Definition nodes.h:159
Relation ri_RelationDesc
Definition execnodes.h:514
TriggerDesc * ri_TrigDesc
Definition execnodes.h:549
Index ri_RangeTableIndex
Definition execnodes.h:511

References ExecOpenIndices(), fb(), makeNode, ResultRelInfo::ri_RangeTableIndex, ResultRelInfo::ri_RelationDesc, and ResultRelInfo::ri_TrigDesc.

Referenced by AddNewAttributeTuples(), AppendAttributeTuples(), CatalogTupleInsert(), CatalogTupleUpdate(), CopyStatistics(), copyTemplateDependencies(), DefineTSConfiguration(), EnumValuesCreate(), InsertPgAttributeTuples(), inv_truncate(), inv_write(), MakeConfigurationMapping(), recordMultipleDependencies(), swap_relation_files(), and update_attstats().

◆ CatalogTupleDelete()

void CatalogTupleDelete ( Relation  heapRel,
const ItemPointerData *  tid 
)
extern

Definition at line 365 of file indexing.c.

366{
367 simple_heap_delete(heapRel, tid);
368}
void simple_heap_delete(Relation relation, const ItemPointerData *tid)
Definition heapam.c:3219

References simple_heap_delete().

Referenced by AlterSetting(), ATExecAlterColumnType(), changeDependenciesOn(), changeDependencyFor(), CreateComments(), CreateSharedComments(), delete_pg_statistic(), delete_pg_statistic_ext_data(), DeleteAttributeTuples(), DeleteComments(), deleteDependencyRecordsFor(), deleteDependencyRecordsForClass(), deleteDependencyRecordsForSpecific(), DeleteInheritsTuple(), DeleteInitPrivs(), deleteOneObject(), DeleteRelationTuple(), DeleteSecurityLabel(), DeleteSequenceTuple(), DeleteSharedComments(), DeleteSharedSecurityLabel(), DeleteSystemAttributeTuples(), DelRoleMems(), drop_parent_dependency(), DropConfigurationMapping(), dropDatabaseDependencies(), dropdb(), DropObjectById(), DropRole(), DropSetting(), DropSubscription(), DropTableSpace(), EnumValuesDelete(), ExecGrant_Parameter(), heap_drop_with_catalog(), index_drop(), IndexSetParentIndex(), inv_truncate(), LargeObjectDrop(), MakeConfigurationMapping(), RangeDelete(), recordExtensionInitPrivWorker(), RelationRemoveInheritance(), RemoveAttrDefaultById(), RemoveConstraintById(), RemoveExtensionById(), RemoveFunctionById(), RemoveOperatorById(), RemovePartitionKeyByRelId(), RemovePolicyById(), RemovePublicationById(), RemovePublicationRelById(), RemovePublicationSchemaById(), RemoveRewriteRuleById(), RemoveRoleFromInitPriv(), RemoveStatistics(), RemoveStatisticsById(), RemoveStatisticsDataById(), RemoveSubscriptionRel(), RemoveTriggerById(), RemoveTSConfigurationById(), RemoveTypeById(), ReplaceRoleInInitPriv(), replorigin_drop_by_name(), SetSecurityLabel(), SetSharedSecurityLabel(), shdepChangeDep(), and shdepDropDependency().

◆ CatalogTupleInsert()

void CatalogTupleInsert ( Relation  heapRel,
HeapTuple  tup 
)
extern

Definition at line 233 of file indexing.c.

234{
236
238
239 indstate = CatalogOpenIndexes(heapRel);
240
241 simple_heap_insert(heapRel, tup);
242
245}
void simple_heap_insert(Relation relation, HeapTuple tup)
Definition heapam.c:2701
static void CatalogIndexInsert(CatalogIndexState indstate, HeapTuple heapTuple, TU_UpdateIndexes updateIndexes)
Definition indexing.c:75
#define CatalogTupleCheckConstraints(heapRel, tup)
Definition indexing.c:217
void CatalogCloseIndexes(CatalogIndexState indstate)
Definition indexing.c:61
CatalogIndexState CatalogOpenIndexes(Relation heapRel)
Definition indexing.c:43
@ TU_All
Definition tableam.h:138

References CatalogCloseIndexes(), CatalogIndexInsert(), CatalogOpenIndexes(), CatalogTupleCheckConstraints, fb(), simple_heap_insert(), and TU_All.

Referenced by AddEnumLabel(), AddRoleMems(), AddSubscriptionRelState(), AggregateCreate(), AlterSetting(), CastCreate(), CollationCreate(), ConversionCreate(), copy_attribute_defaults(), copy_index_constraints(), CreateAccessMethod(), CreateComments(), CreateConstraintEntry(), createdb(), CreateForeignDataWrapper(), CreateForeignServer(), CreateForeignTable(), CreateOpFamily(), CreatePolicy(), CreateProceduralLanguage(), CreatePublication(), CreateRole(), CreateSharedComments(), CreateStatistics(), CreateTableSpace(), CreateTransform(), CreateTriggerFiringOn(), CreateUserMapping(), DefineOpClass(), DefineSequence(), DefineTSConfiguration(), DefineTSDictionary(), DefineTSParser(), DefineTSTemplate(), insert_element_record(), insert_event_trigger_tuple(), insert_label_record(), insert_property_record(), InsertExtensionTuple(), InsertPgClassTuple(), InsertRule(), LargeObjectCreate(), NamespaceCreate(), OperatorCreate(), OperatorShellMake(), ParameterAclCreate(), ProcedureCreate(), publication_add_relation(), publication_add_schema(), RangeCreate(), recordExtensionInitPrivWorker(), replorigin_create(), SetDefaultACL(), SetSecurityLabel(), SetSharedSecurityLabel(), shdepAddDependency(), shdepChangeDep(), statext_store(), StoreAttrDefault(), storeOperators(), StorePartitionKey(), storeProcedures(), StoreSingleInheritance(), TypeCreate(), TypeShellMake(), UpdateIndexRelation(), upsert_pg_statistic(), and upsert_pg_statistic_ext_data().

◆ CatalogTupleInsertWithInfo()

void CatalogTupleInsertWithInfo ( Relation  heapRel,
HeapTuple  tup,
CatalogIndexState  indstate 
)
extern

◆ CatalogTuplesMultiInsertWithInfo()

void CatalogTuplesMultiInsertWithInfo ( Relation  heapRel,
TupleTableSlot **  slot,
int  ntuples,
CatalogIndexState  indstate 
)
extern

Definition at line 273 of file indexing.c.

275{
276 /* Nothing to do */
277 if (ntuples <= 0)
278 return;
279
280 heap_multi_insert(heapRel, slot, ntuples,
281 GetCurrentCommandId(true), 0, NULL);
282
283 /*
284 * There is no equivalent to heap_multi_insert for the catalog indexes, so
285 * we must loop over and insert individually.
286 */
287 for (int i = 0; i < ntuples; i++)
288 {
289 bool should_free;
290 HeapTuple tuple;
291
292 tuple = ExecFetchSlotHeapTuple(slot[i], true, &should_free);
293 tuple->t_tableOid = slot[i]->tts_tableOid;
295
296 if (should_free)
297 heap_freetuple(tuple);
298 }
299}
HeapTuple ExecFetchSlotHeapTuple(TupleTableSlot *slot, bool materialize, bool *shouldFree)
void heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples, CommandId cid, uint32 options, BulkInsertState bistate)
Definition heapam.c:2308
void heap_freetuple(HeapTuple htup)
Definition heaptuple.c:1372
int i
Definition isn.c:77
Oid t_tableOid
Definition htup.h:66
CommandId GetCurrentCommandId(bool used)
Definition xact.c:831

References CatalogIndexInsert(), ExecFetchSlotHeapTuple(), fb(), GetCurrentCommandId(), heap_freetuple(), heap_multi_insert(), i, HeapTupleData::t_tableOid, TupleTableSlot::tts_tableOid, and TU_All.

Referenced by copyTemplateDependencies(), DefineTSConfiguration(), EnumValuesCreate(), InsertPgAttributeTuples(), MakeConfigurationMapping(), and recordMultipleDependencies().

◆ CatalogTupleUpdate()

void CatalogTupleUpdate ( Relation  heapRel,
const ItemPointerData *  otid,
HeapTuple  tup 
)
extern

Definition at line 313 of file indexing.c.

314{
316 TU_UpdateIndexes updateIndexes = TU_All;
317
319
320 indstate = CatalogOpenIndexes(heapRel);
321
322 simple_heap_update(heapRel, otid, tup, &updateIndexes);
323
324 CatalogIndexInsert(indstate, tup, updateIndexes);
326}
void simple_heap_update(Relation relation, const ItemPointerData *otid, HeapTuple tup, TU_UpdateIndexes *update_indexes)
Definition heapam.c:4639
TU_UpdateIndexes
Definition tableam.h:133

References CatalogCloseIndexes(), CatalogIndexInsert(), CatalogOpenIndexes(), CatalogTupleCheckConstraints, fb(), simple_heap_update(), and TU_All.

Referenced by AddRoleMems(), AdjustNotNullInheritance(), AggregateCreate(), AlterCollation(), AlterConstraintNamespaces(), AlterConstrTriggerDeferrability(), AlterConstrUpdateConstraintEntry(), AlterDatabase(), AlterDatabaseOwner(), AlterDatabaseRefreshColl(), AlterDomainAddConstraint(), AlterDomainDefault(), AlterDomainDropConstraint(), AlterDomainNotNull(), AlterDomainValidateConstraint(), AlterEventTrigger(), AlterEventTriggerOwner_internal(), AlterExtensionNamespace(), AlterForeignDataWrapper(), AlterForeignDataWrapperOwner_internal(), AlterForeignServer(), AlterForeignServerOwner_internal(), AlterFunction(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterOperator(), AlterPolicy(), AlterPublicationAllFlags(), AlterPublicationOptions(), AlterPublicationOwner_internal(), AlterRelationNamespaceInternal(), AlterRole(), AlterSchemaOwner_internal(), AlterSequence(), AlterSetting(), AlterStatistics(), AlterSubscription(), AlterSubscriptionOwner_internal(), AlterTableSpaceOptions(), AlterTSDictionary(), AlterTypeNamespaceInternal(), AlterTypeOwnerInternal(), AlterTypeRecurse(), AlterUserMapping(), ApplyExtensionUpdates(), ATExecAddColumn(), ATExecAddIdentity(), ATExecAddOf(), ATExecAlterColumnGenericOptions(), ATExecAlterColumnType(), ATExecAlterConstrInheritability(), ATExecChangeOwner(), ATExecDropColumn(), ATExecDropExpression(), ATExecDropIdentity(), ATExecDropOf(), ATExecForceNoForceRowSecurity(), ATExecGenericOptions(), ATExecSetAccessMethodNoStorage(), ATExecSetCompression(), ATExecSetIdentity(), ATExecSetNotNull(), ATExecSetOptions(), ATExecSetRelOptions(), ATExecSetRowSecurity(), ATExecSetStatistics(), ATExecSetStorage(), change_owner_fix_column_acls(), changeDependenciesOf(), changeDependenciesOn(), changeDependencyFor(), clear_subscription_skip_lsn(), ConstraintSetParentConstraint(), copy_attribute_defaults(), copy_table_data(), create_toast_table(), CreateComments(), CreateProceduralLanguage(), CreateSharedComments(), CreateTransform(), CreateTriggerFiringOn(), DefineIndex(), DelRoleMems(), DetachPartitionFinalize(), DisableSubscription(), dropconstraint_internal(), EnableDisableRule(), EnableDisableTrigger(), ExecGrant_Attribute(), ExecGrant_common(), ExecGrant_Largeobject(), ExecGrant_Parameter(), ExecGrant_Relation(), extension_config_remove(), finish_heap_swap(), index_build(), index_concurrently_swap(), index_constraint_create(), index_set_state_flags(), InsertRule(), mark_index_clustered(), MarkInheritDetached(), MergeAttributesIntoExisting(), MergeConstraintsIntoExisting(), MergeWithExistingConstraint(), movedb(), OperatorCreate(), OperatorUpd(), pg_extension_config_dump(), ProcedureCreate(), QueueCheckConstraintValidation(), QueueFKConstraintValidation(), QueueNNConstraintValidation(), recordExtensionInitPrivWorker(), reindex_index(), relation_mark_replica_identity(), relation_statistics_update_internal(), RelationClearMissing(), RelationSetNewRelfilenumber(), RemoveAttrDefaultById(), RemoveAttributeById(), RemoveConstraintById(), RemoveInheritance(), RemoveRoleFromInitPriv(), RemoveRoleFromObjectPolicy(), rename_policy(), renameatt_internal(), RenameConstraintById(), RenameDatabase(), RenameEnumLabel(), RenameRelationInternal(), RenameRewriteRule(), RenameRole(), RenameSchema(), RenameTableSpace(), renametrig_internal(), RenameTypeInternal(), RenumberEnumType(), ReplaceRoleInInitPriv(), ResetRelRewrite(), set_attnotnull(), SetAttrMissing(), SetDatabaseHasLoginEventTriggers(), SetDefaultACL(), SetIndexStorageProperties(), SetMatViewPopulatedState(), SetRelationHasSubclass(), SetRelationNumChecks(), SetRelationRuleStatus(), SetRelationTableSpace(), SetSecurityLabel(), SetSharedSecurityLabel(), shdepChangeDep(), StoreAttrDefault(), StoreAttrMissingVal(), StorePartitionBound(), TriggerSetParentTrigger(), TypeCreate(), update_default_partition_oid(), update_relispartition(), UpdateDeadTupleRetentionStatus(), UpdateSubscriptionRelState(), UpdateTwoPhaseState(), upsert_pg_statistic(), upsert_pg_statistic_ext_data(), and validatePartitionedIndex().

◆ CatalogTupleUpdateWithInfo()

void CatalogTupleUpdateWithInfo ( Relation  heapRel,
const ItemPointerData *  otid,
HeapTuple  tup,
CatalogIndexState  indstate 
)
extern

Definition at line 337 of file indexing.c.

339{
340 TU_UpdateIndexes updateIndexes = TU_All;
341
343
344 simple_heap_update(heapRel, otid, tup, &updateIndexes);
345
346 CatalogIndexInsert(indstate, tup, updateIndexes);
347}

References CatalogIndexInsert(), CatalogTupleCheckConstraints, fb(), simple_heap_update(), and TU_All.

Referenced by inv_truncate(), inv_write(), MakeConfigurationMapping(), swap_relation_files(), and update_attstats().