|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <unistd.h>#include "access/amapi.h"#include "access/attmap.h"#include "access/heapam.h"#include "access/multixact.h"#include "access/relscan.h"#include "access/tableam.h"#include "access/toast_compression.h"#include "access/transam.h"#include "access/visibilitymap.h"#include "access/xact.h"#include "bootstrap/bootstrap.h"#include "catalog/binary_upgrade.h"#include "catalog/catalog.h"#include "catalog/dependency.h"#include "catalog/heap.h"#include "catalog/index.h"#include "catalog/objectaccess.h"#include "catalog/partition.h"#include "catalog/pg_am.h"#include "catalog/pg_collation.h"#include "catalog/pg_constraint.h"#include "catalog/pg_description.h"#include "catalog/pg_inherits.h"#include "catalog/pg_opclass.h"#include "catalog/pg_operator.h"#include "catalog/pg_tablespace.h"#include "catalog/pg_trigger.h"#include "catalog/pg_type.h"#include "catalog/storage.h"#include "catalog/storage_xlog.h"#include "commands/event_trigger.h"#include "commands/progress.h"#include "commands/tablecmds.h"#include "commands/trigger.h"#include "executor/executor.h"#include "miscadmin.h"#include "nodes/makefuncs.h"#include "nodes/nodeFuncs.h"#include "optimizer/optimizer.h"#include "parser/parser.h"#include "pgstat.h"#include "postmaster/autovacuum.h"#include "rewrite/rewriteManip.h"#include "storage/bufmgr.h"#include "storage/lmgr.h"#include "storage/predicate.h"#include "storage/smgr.h"#include "utils/builtins.h"#include "utils/fmgroids.h"#include "utils/guc.h"#include "utils/inval.h"#include "utils/lsyscache.h"#include "utils/memutils.h"#include "utils/pg_rusage.h"#include "utils/rel.h"#include "utils/snapmgr.h"#include "utils/syscache.h"#include "utils/tuplesort.h"
Go to the source code of this file.
Data Structures | |
| struct | SerializedReindexState |
|
static |
Definition at line 513 of file index.c.
References CatalogCloseIndexes(), CatalogOpenIndexes(), fb(), i, InsertPgAttributeTuples(), InvalidOid, TupleDescData::natts, palloc0_array, RelationData::rd_att, RelationGetDescr, RowExclusiveLock, table_close(), and table_open().
Referenced by index_create().
Definition at line 2489 of file index.c.
References elog, ERROR, fb(), Form_pg_index, i, IndexInfo::ii_IndexAttrNumbers, INDEX_MAX_KEYS, makeIndexInfo(), NIL, RelationGetDummyIndexExpressions(), and RelationGetRelid.
Referenced by RelationTruncateIndexes().
Definition at line 2429 of file index.c.
References elog, ERROR, fb(), Form_pg_index, i, IndexInfo::ii_ExclusionOps, IndexInfo::ii_ExclusionProcs, IndexInfo::ii_ExclusionStrats, IndexInfo::ii_IndexAttrNumbers, INDEX_MAX_KEYS, makeIndexInfo(), RelationGetExclusionInfo(), RelationGetIndexExpressions(), RelationGetIndexPredicate(), and RelationGetRelid.
Referenced by _brin_parallel_scan_and_build(), _bt_parallel_scan_and_sort(), _gin_parallel_scan_and_build(), ATExecAddIndexConstraint(), ATExecAttachPartitionIdx(), AttachPartitionEnsureIndexes(), brinsummarize(), bt_check_every_level(), build_index_value_desc(), DefineIndex(), do_analyze_rel(), ExecOpenIndices(), index_concurrently_build(), index_concurrently_create_copy(), reindex_index(), tuplesort_begin_cluster(), unique_key_recheck(), and validate_index().
Definition at line 2670 of file index.c.
References Assert, COMPARE_EQ, elog, ERROR, fb(), get_opcode(), get_opfamily_member(), i, IndexInfo::ii_Unique, IndexInfo::ii_UniqueOps, IndexInfo::ii_UniqueProcs, IndexInfo::ii_UniqueStrats, IndexAmTranslateCompareType(), IndexRelationGetNumberOfKeyAttributes, OidIsValid, and palloc_array.
Referenced by BuildConflictIndexInfo(), and ExecOpenIndices().
| bool CompareIndexInfo | ( | const IndexInfo * | info1, |
| const IndexInfo * | info2, | ||
| const Oid * | collations1, | ||
| const Oid * | collations2, | ||
| const Oid * | opfamilies1, | ||
| const Oid * | opfamilies2, | ||
| const AttrMap * | attmap | ||
| ) |
Definition at line 2538 of file index.c.
References elog, equal(), ERROR, fb(), i, InvalidAttrNumber, InvalidOid, map_variable_attnos(), and NIL.
Referenced by ATExecAttachPartitionIdx(), AttachPartitionEnsureIndexes(), and DefineIndex().
|
static |
Definition at line 282 of file index.c.
References Assert, ATTRIBUTE_FIXED_PART_SIZE, AttrNumberGetAttrOffset, CheckAttributeType(), CreateTemplateTupleDesc(), elog, ERROR, exprType(), exprTypmod(), fb(), Form_pg_opclass, Form_pg_type, FormData_pg_attribute, get_base_element_type(), GetIndexAmRoutineByAmId(), GETSTRUCT(), HeapTupleIsValid, i, IndexInfo::ii_Expressions, IndexInfo::ii_IndexAttrNumbers, IndexInfo::ii_NumIndexAttrs, IndexInfo::ii_NumIndexKeyAttrs, InvalidCompressionMethod, InvalidOid, lfirst, list_head(), lnext(), MemSet, NameStr, namestrcpy(), NIL, ObjectIdGetDatum(), OidIsValid, populate_compact_attribute(), RelationGetDescr, RelationGetForm, ReleaseSysCache(), SearchSysCache1(), TupleDescAttr(), and TupleDescFinalize().
Referenced by index_create().
Definition at line 4243 of file index.c.
References fb(), list_length(), mul_size(), and pendingReindexedIndexes.
Referenced by InitializeParallelDSM().
| void FormIndexDatum | ( | IndexInfo * | indexInfo, |
| TupleTableSlot * | slot, | ||
| EState * | estate, | ||
| Datum * | values, | ||
| bool * | isnull | ||
| ) |
Definition at line 2731 of file index.c.
References Assert, elog, ERROR, ExecEvalExprSwitchContext(), ExecPrepareExprList(), fb(), GetPerTupleExprContext, i, IndexInfo::ii_Expressions, IndexInfo::ii_ExpressionsState, IndexInfo::ii_IndexAttrNumbers, IndexInfo::ii_NumIndexAttrs, lfirst, list_head(), lnext(), NIL, slot_getattr(), slot_getsysattr(), and values.
Referenced by build_index_value_desc(), CatalogIndexInsert(), check_exclusion_or_unique_constraint(), comparetup_cluster_tiebreak(), compute_index_stats(), ExecCheckIndexConstraints(), ExecInsertIndexTuples(), heapam_index_build_range_scan(), heapam_index_validate_scan(), IndexCheckExclusion(), and unique_key_recheck().
| void index_build | ( | Relation | heapRelation, |
| Relation | indexRelation, | ||
| IndexInfo * | indexInfo, | ||
| bool | isreindex, | ||
| bool | parallel | ||
| ) |
Definition at line 3003 of file index.c.
References IndexAmRoutine::ambuild, IndexAmRoutine::ambuildempty, IndexAmRoutine::amcanbuildparallel, Assert, AtEOXact_GUC(), CatalogTupleUpdate(), CommandCounterIncrement(), DEBUG1, elog, ereport, errmsg_internal(), ERROR, fb(), Form_pg_index, GETSTRUCT(), GetUserIdAndSecContext(), heap_freetuple(), IndexBuildResult::heap_tuples, HeapTupleIsValid, IndexInfo::ii_BrokenHotChain, IndexInfo::ii_Concurrent, IndexInfo::ii_ExclusionOps, IndexInfo::ii_ParallelWorkers, IndexBuildResult::index_tuples, index_update_stats(), IndexCheckExclusion(), INIT_FORKNUM, IsNormalProcessingMode, log_smgrcreate(), NewGUCNestLevel(), ObjectIdGetDatum(), pgstat_progress_update_multi_param(), plan_create_index_workers(), PROGRESS_CREATEIDX_PHASE, PROGRESS_CREATEIDX_PHASE_BUILD, PROGRESS_CREATEIDX_SUBPHASE, PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE, PROGRESS_CREATEIDX_TUPLES_DONE, PROGRESS_CREATEIDX_TUPLES_TOTAL, PROGRESS_SCAN_BLOCKS_DONE, PROGRESS_SCAN_BLOCKS_TOTAL, RelationData::rd_indam, RelationData::rd_locator, RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, RelationGetSmgr(), RelationIsValid, RestrictSearchPath(), RowExclusiveLock, SearchSysCacheCopy1, SECURITY_RESTRICTED_OPERATION, SetUserIdAndSecContext(), smgrcreate(), smgrexists(), table_close(), and table_open().
Referenced by build_indices(), index_concurrently_build(), index_create(), reindex_index(), and RelationTruncateIndexes().
| void index_check_primary_key | ( | Relation | heapRel, |
| const IndexInfo * | indexInfo, | ||
| bool | is_alter_table, | ||
| const IndexStmt * | stmt | ||
| ) |
Definition at line 203 of file index.c.
References attnum, elog, ereport, errcode(), errmsg, ERROR, fb(), GETSTRUCT(), HeapTupleIsValid, i, IndexInfo::ii_IndexAttrNumbers, IndexInfo::ii_NullsNotDistinct, IndexInfo::ii_NumIndexKeyAttrs, Int16GetDatum(), NameStr, ObjectIdGetDatum(), RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, relationHasPrimaryKey(), ReleaseSysCache(), and SearchSysCache2().
Referenced by ATExecAddIndexConstraint(), and DefineIndex().
Definition at line 1486 of file index.c.
References ActiveSnapshotSet(), Assert, AtEOXact_GUC(), BuildIndexInfo(), fb(), GetUserIdAndSecContext(), IndexInfo::ii_BrokenHotChain, IndexInfo::ii_Concurrent, IndexInfo::ii_ReadyForInserts, index_build(), index_close(), INDEX_CREATE_SET_READY, index_open(), index_set_state_flags(), NewGUCNestLevel(), NoLock, RelationData::rd_rel, RestrictSearchPath(), RowExclusiveLock, SECURITY_RESTRICTED_OPERATION, SetUserIdAndSecContext(), ShareUpdateExclusiveLock, table_close(), and table_open().
Referenced by DefineIndex(), and ReindexRelationConcurrently().
| Oid index_concurrently_create_copy | ( | Relation | heapRelation, |
| Oid | oldIndexId, | ||
| Oid | tablespaceOid, | ||
| const char * | newName | ||
| ) |
Definition at line 1301 of file index.c.
References IndexAmRoutine::amsummarizing, BuildIndexInfo(), DatumGetPointer(), elog, ereport, errcode(), errmsg, ERROR, fb(), get_attoptions(), HeapTupleIsValid, i, index_close(), index_create(), INDEX_CREATE_CONCURRENT, INDEX_CREATE_SKIP_BUILD, index_open(), Int16GetDatum(), InvalidOid, InvalidRelFileNumber, lappend(), make_ands_implicit(), makeIndexInfo(), NameStr, NIL, NoLock, ObjectIdGetDatum(), palloc0_array, pfree(), RelationData::rd_indam, RelationData::rd_indcollation, RelationData::rd_rel, RelationGetDescr, ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), SearchSysCache2(), stringToNode(), SysCacheGetAttr(), SysCacheGetAttrNotNull(), TextDatumGetCString, and TupleDescAttr().
Referenced by ReindexRelationConcurrently().
Definition at line 1824 of file index.c.
References CacheInvalidateRelcache(), fb(), index_close(), INDEX_DROP_SET_DEAD, index_open(), index_set_state_flags(), NoLock, ShareUpdateExclusiveLock, table_close(), table_open(), and TransferPredicateLocksToHeapRelation().
Referenced by index_drop(), and ReindexRelationConcurrently().
Definition at line 1553 of file index.c.
References BTEqualStrategyNumber, CatalogTupleUpdate(), changeDependenciesOf(), changeDependenciesOn(), CopyStatistics(), DeleteInheritsTuple(), description, elog, ERROR, fb(), Form_pg_constraint, Form_pg_index, Form_pg_trigger, get_index_constraint(), get_index_ref_constraints(), get_partition_ancestors(), get_rel_relispartition(), GETSTRUCT(), heap_copytuple(), heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, Int32GetDatum(), lappend_oid(), lfirst_oid, linitial_oid, list_free(), NameStr, namestrcpy(), NIL, NoLock, ObjectIdGetDatum(), OidIsValid, pgstat_copy_relation_stats(), relation_close(), relation_open(), RelationGetDescr, RowExclusiveLock, ScanKeyInit(), SearchSysCacheCopy1, ShareUpdateExclusiveLock, StoreSingleInheritance(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), table_open(), and values.
Referenced by ReindexRelationConcurrently().
| ObjectAddress index_constraint_create | ( | Relation | heapRelation, |
| Oid | indexRelationId, | ||
| Oid | parentConstraintId, | ||
| const IndexInfo * | indexInfo, | ||
| const char * | constraintName, | ||
| char | constraintType, | ||
| bits16 | constr_flags, | ||
| bool | allow_system_table_mods, | ||
| bool | is_internal | ||
| ) |
Definition at line 1886 of file index.c.
References Assert, CacheInvalidateRelcache(), CatalogTupleUpdate(), CreateConstraintEntry(), CreateTrigger(), deleteDependencyRecordsForClass(), DEPENDENCY_AUTO, DEPENDENCY_INTERNAL, DEPENDENCY_PARTITION_PRI, DEPENDENCY_PARTITION_SEC, elog, ereport, errcode(), errmsg, ERROR, fb(), Form_pg_index, GETSTRUCT(), heap_freetuple(), HeapTupleIsValid, IndexInfo::ii_ExclusionOps, IndexInfo::ii_Expressions, IndexInfo::ii_IndexAttrNumbers, IndexInfo::ii_NumIndexAttrs, IndexInfo::ii_NumIndexKeyAttrs, INDEX_CONSTR_CREATE_DEFERRABLE, INDEX_CONSTR_CREATE_INIT_DEFERRED, INDEX_CONSTR_CREATE_MARK_AS_PRIMARY, INDEX_CONSTR_CREATE_REMOVE_OLD_DEPS, INDEX_CONSTR_CREATE_UPDATE_INDEX, INDEX_CONSTR_CREATE_WITHOUT_OVERLAPS, InvalidOid, InvokeObjectPostAlterHookArg, IsBootstrapProcessingMode, IsNormalProcessingMode, IsSystemRelation(), makeNode, NIL, ObjectAddressSet, ObjectIdGetDatum(), OidIsValid, recordDependencyOn(), RelationGetNamespace, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopy1, SystemFuncName(), table_close(), and table_open().
Referenced by ATExecAddIndexConstraint(), and index_create().
| Oid index_create | ( | Relation | heapRelation, |
| const char * | indexRelationName, | ||
| Oid | indexRelationId, | ||
| Oid | parentIndexRelid, | ||
| Oid | parentConstraintId, | ||
| RelFileNumber | relFileNumber, | ||
| IndexInfo * | indexInfo, | ||
| const List * | indexColNames, | ||
| Oid | accessMethodId, | ||
| Oid | tableSpaceId, | ||
| const Oid * | collationIds, | ||
| const Oid * | opclassIds, | ||
| const Datum * | opclassOptions, | ||
| const int16 * | coloptions, | ||
| const NullableDatum * | stattargets, | ||
| Datum | reloptions, | ||
| bits16 | flags, | ||
| bits16 | constr_flags, | ||
| bool | allow_system_table_mods, | ||
| bool | is_internal, | ||
| Oid * | constraintId | ||
| ) |
Definition at line 727 of file index.c.
References AccessExclusiveLock, add_exact_object_address(), AppendAttributeTuples(), Assert, binary_upgrade_next_index_pg_class_oid, binary_upgrade_next_index_pg_class_relfilenumber, CacheInvalidateRelcache(), CommandCounterIncrement(), CONSTRAINT_RELATION, ConstraintNameIsUsed(), ConstructTupleDescriptor(), DEPENDENCY_AUTO, DEPENDENCY_NORMAL, DEPENDENCY_PARTITION_PRI, DEPENDENCY_PARTITION_SEC, elog, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg, ERROR, fb(), Form_pg_opclass, free_object_addresses(), get_collation_isdeterministic(), get_relname_relid(), GetNewRelFileNumber(), GETSTRUCT(), heap_create(), HeapTupleIsValid, i, IndexInfo::ii_ExclusionOps, IndexInfo::ii_Expressions, IndexInfo::ii_IndexAttrNumbers, IndexInfo::ii_NumIndexAttrs, IndexInfo::ii_NumIndexKeyAttrs, IndexInfo::ii_Predicate, IndexInfo::ii_Unique, index_build(), index_close(), INDEX_CONSTR_CREATE_DEFERRABLE, index_constraint_create(), INDEX_CREATE_ADD_CONSTRAINT, INDEX_CREATE_CONCURRENT, INDEX_CREATE_IF_NOT_EXISTS, INDEX_CREATE_INVALID, INDEX_CREATE_IS_PRIMARY, INDEX_CREATE_PARTITIONED, INDEX_CREATE_SKIP_BUILD, index_opclass_options(), index_register(), index_update_stats(), InitializeAttributeOids(), InsertPgClassTuple(), invalid, InvalidMultiXactId, InvalidOid, InvalidRelFileNumber, InvalidTransactionId, InvokeObjectPostCreateHookArg, IsBinaryUpgrade, IsBootstrapProcessingMode, IsCatalogRelation(), IsNormalProcessingMode, IsSystemRelation(), LockRelation(), LockRelationOid(), NameStr, new_object_addresses(), NoLock, NOTICE, ObjectAddressSet, ObjectAddressSubSet, ObjectIdGetDatum(), OidIsValid, RelationData::rd_index, RelationData::rd_indexcxt, RelationData::rd_rel, record_object_address_dependencies(), recordDependencyOn(), recordDependencyOnSingleRelExpr(), RelationGetNamespace, RelationGetRelationName, RelationGetRelid, RelationInitIndexAccessInfo(), RelationIsMapped, ReleaseSysCache(), RelFileNumberIsValid, RowExclusiveLock, SearchSysCache1(), SetRelationHasSubclass(), ShareUpdateExclusiveLock, StoreSingleInheritance(), table_close(), table_open(), and UpdateIndexRelation().
Referenced by create_toast_table(), DefineIndex(), and index_concurrently_create_copy().
Definition at line 2123 of file index.c.
References AccessExclusiveLock, Assert, CacheInvalidateRelcache(), CatalogTupleDelete(), CheckTableNotInUse(), CommitTransactionCommand(), LockRelId::dbId, DeleteAttributeTuples(), DeleteInheritsTuple(), DeleteRelationTuple(), elog, ereport, errcode(), errmsg, ERROR, fb(), get_rel_persistence(), GetTopTransactionIdIfAny(), GetTransactionSnapshot(), heap_attisnull(), HeapTupleIsValid, index_close(), index_concurrently_set_dead(), INDEX_DROP_CLEAR_VALID, index_open(), index_set_state_flags(), IndexGetRelation(), InvalidOid, InvalidTransactionId, LockRelationIdForSession(), NoLock, ObjectIdGetDatum(), pgstat_drop_relation(), PopActiveSnapshot(), PushActiveSnapshot(), RelationDropStorage(), RelationForgetRelation(), RelationGetDescr, ReleaseSysCache(), LockRelId::relId, RemoveStatistics(), RowExclusiveLock, SearchSysCache1(), SET_LOCKTAG_RELATION, ShareUpdateExclusiveLock, StartTransactionCommand(), HeapTupleData::t_self, table_close(), table_open(), TransferPredicateLocksToHeapRelation(), UnlockRelationIdForSession(), and WaitForLockers().
Referenced by doDeletion().
| void index_set_state_flags | ( | Oid | indexId, |
| IndexStateFlagsAction | action | ||
| ) |
Definition at line 3504 of file index.c.
References Assert, CatalogTupleUpdate(), elog, ERROR, fb(), Form_pg_index, GETSTRUCT(), HeapTupleIsValid, INDEX_CREATE_SET_READY, INDEX_CREATE_SET_VALID, INDEX_DROP_CLEAR_VALID, INDEX_DROP_SET_DEAD, ObjectIdGetDatum(), RowExclusiveLock, SearchSysCacheCopy1, table_close(), and table_open().
Referenced by DefineIndex(), index_concurrently_build(), index_concurrently_set_dead(), and index_drop().
Definition at line 2810 of file index.c.
References Assert, AutoVacuumingActive(), BTEqualStrategyNumber, CacheInvalidateRelcacheByTuple(), elog, ERROR, fb(), GETSTRUCT(), heap_freetuple(), HeapTupleIsValid, IsBinaryUpgrade, ObjectIdGetDatum(), RelationData::rd_options, RelationData::rd_rel, RelationGetNumberOfBlocks, RelationGetRelid, RowExclusiveLock, ScanKeyInit(), systable_inplace_update_begin(), systable_inplace_update_cancel(), systable_inplace_update_finish(), table_close(), table_open(), and visibilitymap_count().
Referenced by index_build(), and index_create().
|
static |
Definition at line 3196 of file index.c.
References check_exclusion_constraint(), CHECK_FOR_INTERRUPTS, CreateExecutorState(), ExprContext::ecxt_per_tuple_memory, ExprContext::ecxt_scantuple, ExecDropSingleTupleTableSlot(), ExecPrepareQual(), ExecQual(), fb(), FormIndexDatum(), ForwardScanDirection, FreeExecutorState(), GetLatestSnapshot(), GetPerTupleExprContext, IndexInfo::ii_ExpressionsState, IndexInfo::ii_Predicate, IndexInfo::ii_PredicateState, INDEX_MAX_KEYS, MemoryContextReset(), NIL, RegisterSnapshot(), ReindexIsCurrentlyProcessingIndex(), RelationGetRelid, ResetReindexProcessing(), table_beginscan_strat(), table_endscan(), table_scan_getnextslot(), table_slot_create(), TupleTableSlot::tts_tid, UnregisterSnapshot(), and values.
Referenced by index_build().
Definition at line 3584 of file index.c.
References Assert, elog, ERROR, fb(), Form_pg_index, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache1().
Referenced by amcheck_lock_relation_and_check(), ATPostAlterTypeCleanup(), brin_desummarize_range(), brin_summarize_range(), bringetbitmap(), brinvacuumcleanup(), CheckIndexCompatible(), DetachPartitionFinalize(), get_tables_to_repack_partitioned(), index_drop(), pg_prewarm(), RangeVarCallbackForAttachIndex(), RangeVarCallbackForDropRelation(), RangeVarCallbackForReindexIndex(), RangeVarCallbackForStats(), reindex_index(), and ReindexRelationConcurrently().
Definition at line 495 of file index.c.
References fb(), i, RelationGetDescr, and TupleDescAttr().
Referenced by index_create().
| void reindex_index | ( | const ReindexStmt * | stmt, |
| Oid | indexId, | ||
| bool | skip_constraint_checks, | ||
| char | persistence, | ||
| const ReindexParams * | params | ||
| ) |
Definition at line 3609 of file index.c.
References AccessExclusiveLock, AtEOXact_GUC(), BuildIndexInfo(), CacheInvalidateRelcache(), CatalogTupleUpdate(), CheckRelationTableSpaceMove(), CheckTableNotInUse(), CommandCounterIncrement(), elog, ereport, errcode(), errdetail_internal(), errmsg, ERROR, EventTriggerCollectSimpleCommand(), fb(), Form_pg_index, get_index_isvalid(), get_namespace_name(), get_rel_name(), GETSTRUCT(), GetUserIdAndSecContext(), HeapTupleIsValid, IndexInfo::ii_BrokenHotChain, IndexInfo::ii_ExclusionOps, IndexInfo::ii_ExclusionProcs, IndexInfo::ii_ExclusionStrats, IndexInfo::ii_Unique, index_build(), index_close(), index_open(), IndexGetRelation(), INFO, InvalidObjectAddress, InvalidOid, IsSystemRelation(), IsToastNamespace(), NewGUCNestLevel(), NoLock, ObjectAddressSet, ObjectIdGetDatum(), OidIsValid, ReindexParams::options, pg_rusage_init(), pg_rusage_show(), pgstat_progress_end_command(), pgstat_progress_start_command(), pgstat_progress_update_multi_param(), pgstat_progress_update_param(), progress, PROGRESS_COMMAND_CREATE_INDEX, PROGRESS_CREATEIDX_ACCESS_METHOD_OID, PROGRESS_CREATEIDX_COMMAND, PROGRESS_CREATEIDX_COMMAND_REINDEX, PROGRESS_CREATEIDX_INDEX_OID, RelationData::rd_rel, REINDEXOPT_MISSING_OK, REINDEXOPT_REPORT_PROGRESS, REINDEXOPT_VERBOSE, RELATION_IS_OTHER_TEMP, RelationAssumeNewRelfilelocator(), RelationDropStorage(), RelationGetNamespace, RelationGetRelationName, RelationSetNewRelfilenumber(), ResetReindexProcessing(), RestrictSearchPath(), RowExclusiveLock, SearchSysCacheCopy1, SECURITY_RESTRICTED_OPERATION, SetReindexProcessing(), SetRelationTableSpace(), SetUserIdAndSecContext(), ShareLock, stmt, table_close(), table_open(), ReindexParams::tablespaceOid, TransferPredicateLocksToHeapRelation(), try_index_open(), and try_table_open().
Referenced by reindex_relation(), ReindexIndex(), and ReindexMultipleInternal().
| bool reindex_relation | ( | const ReindexStmt * | stmt, |
| Oid | relid, | ||
| int | flags, | ||
| const ReindexParams * | params | ||
| ) |
Definition at line 3949 of file index.c.
References Assert, CommandCounterIncrement(), elog, ereport, errcode(), errmsg, ERROR, fb(), get_index_isvalid(), get_namespace_name(), get_rel_name(), get_rel_namespace(), i, InvalidOid, IsToastNamespace(), lfirst_oid, NIL, NoLock, OidIsValid, ReindexParams::options, pgstat_progress_update_param(), PROGRESS_REPACK_INDEX_REBUILD_COUNT, RelationData::rd_rel, reindex_index(), REINDEX_REL_CHECK_CONSTRAINTS, REINDEX_REL_FORCE_INDEXES_PERMANENT, REINDEX_REL_FORCE_INDEXES_UNLOGGED, REINDEX_REL_PROCESS_TOAST, REINDEX_REL_SUPPRESS_INDEX_USE, reindex_relation(), ReindexIsProcessingIndex(), REINDEXOPT_MISSING_OK, RelationGetIndexList(), RelationGetNamespace, RelationGetRelationName, RemoveReindexPending(), SetReindexPending(), ShareLock, stmt, table_close(), table_open(), try_table_open(), and WARNING.
Referenced by ExecuteTruncateGuts(), finish_heap_swap(), reindex_relation(), ReindexMultipleInternal(), and ReindexTable().
Definition at line 4130 of file index.c.
References currentlyReindexedIndex.
Referenced by IndexCheckExclusion().
Definition at line 4141 of file index.c.
References currentlyReindexedIndex, list_member_oid(), and pendingReindexedIndexes.
Referenced by CatalogIndexInsert(), reindex_relation(), systable_beginscan(), and systable_beginscan_ordered().
Definition at line 149 of file index.c.
References elog, ERROR, fb(), Form_pg_index, GETSTRUCT(), HeapTupleIsValid, lfirst_oid, list_free(), ObjectIdGetDatum(), RelationGetIndexList(), ReleaseSysCache(), and SearchSysCache1().
Referenced by index_check_primary_key().
Definition at line 4201 of file index.c.
References elog, ERROR, IsInParallelMode(), list_delete_oid(), and pendingReindexedIndexes.
Referenced by reindex_relation(), and SetReindexProcessing().
Definition at line 4171 of file index.c.
References currentlyReindexedHeap, currentlyReindexedIndex, and InvalidOid.
Referenced by IndexCheckExclusion(), and reindex_index().
Definition at line 4214 of file index.c.
References currentlyReindexedHeap, currentlyReindexedIndex, InvalidOid, NIL, pendingReindexedIndexes, and reindexingNestLevel.
Referenced by AbortSubTransaction(), and AbortTransaction().
Definition at line 4272 of file index.c.
References Assert, currentlyReindexedHeap, currentlyReindexedIndex, fb(), GetCurrentTransactionNestLevel(), lappend_oid(), MemoryContextSwitchTo(), NIL, pendingReindexedIndexes, reindexingNestLevel, and TopMemoryContext.
Referenced by ParallelWorkerMain().
Definition at line 4254 of file index.c.
References currentlyReindexedHeap, currentlyReindexedIndex, fb(), lfirst_oid, list_length(), and pendingReindexedIndexes.
Referenced by InitializeParallelDSM().
Definition at line 4185 of file index.c.
References elog, ERROR, GetCurrentTransactionNestLevel(), IsInParallelMode(), list_copy(), pendingReindexedIndexes, and reindexingNestLevel.
Referenced by reindex_relation().
Definition at line 4152 of file index.c.
References Assert, currentlyReindexedHeap, currentlyReindexedIndex, elog, ERROR, GetCurrentTransactionNestLevel(), OidIsValid, reindexingNestLevel, and RemoveReindexPending().
Referenced by reindex_index().
|
static |
Definition at line 564 of file index.c.
References BoolGetDatum(), buildint2vector(), buildoidvector(), CatalogTupleInsert(), CStringGetTextDatum, fb(), heap_form_tuple(), heap_freetuple(), i, IndexInfo::ii_Expressions, IndexInfo::ii_IndexAttrNumbers, IndexInfo::ii_NullsNotDistinct, IndexInfo::ii_NumIndexAttrs, IndexInfo::ii_NumIndexKeyAttrs, IndexInfo::ii_Predicate, IndexInfo::ii_Unique, Int16GetDatum(), make_ands_explicit(), NIL, nodeToString(), ObjectIdGetDatum(), pfree(), PointerGetDatum(), RelationGetDescr, RowExclusiveLock, table_close(), table_open(), and values.
Referenced by index_create().
Definition at line 3351 of file index.c.
References AtEOXact_GUC(), BuildIndexInfo(), DEBUG2, elog, fb(), GetUserIdAndSecContext(), IndexInfo::ii_Concurrent, index_bulk_delete(), index_close(), index_insert_cleanup(), index_open(), InvalidOid, maintenance_work_mem, NewGUCNestLevel(), NoLock, pgstat_progress_update_multi_param(), pgstat_progress_update_param(), PROGRESS_CREATEIDX_PHASE, PROGRESS_CREATEIDX_PHASE_VALIDATE_IDXSCAN, PROGRESS_CREATEIDX_PHASE_VALIDATE_SORT, PROGRESS_CREATEIDX_PHASE_VALIDATE_TABLESCAN, PROGRESS_CREATEIDX_TUPLES_DONE, PROGRESS_CREATEIDX_TUPLES_TOTAL, PROGRESS_SCAN_BLOCKS_DONE, PROGRESS_SCAN_BLOCKS_TOTAL, RelationData::rd_rel, RestrictSearchPath(), RowExclusiveLock, SECURITY_RESTRICTED_OPERATION, SetUserIdAndSecContext(), ShareUpdateExclusiveLock, table_close(), table_index_validate_scan(), table_open(), tuplesort_begin_datum(), tuplesort_end(), TUPLESORT_NONE, tuplesort_performsort(), and validate_index_callback().
Referenced by DefineIndex(), and ReindexRelationConcurrently().
|
static |
Definition at line 3484 of file index.c.
References fb(), Int64GetDatum(), itemptr_encode(), and tuplesort_putdatum().
Referenced by validate_index().
| Oid binary_upgrade_next_index_pg_class_oid = InvalidOid |
Definition at line 86 of file index.c.
Referenced by binary_upgrade_set_next_index_pg_class_oid(), and index_create().
| RelFileNumber binary_upgrade_next_index_pg_class_relfilenumber |
Definition at line 87 of file index.c.
Referenced by binary_upgrade_set_next_index_relfilenode(), index_create(), and RelationSetNewRelfilenumber().
|
static |
Definition at line 4110 of file index.c.
Referenced by ReindexIsProcessingHeap(), ResetReindexProcessing(), ResetReindexState(), RestoreReindexState(), SerializeReindexState(), and SetReindexProcessing().
|
static |
Definition at line 4111 of file index.c.
Referenced by ReindexIsCurrentlyProcessingIndex(), ReindexIsProcessingIndex(), ResetReindexProcessing(), ResetReindexState(), RestoreReindexState(), SerializeReindexState(), and SetReindexProcessing().
Definition at line 4112 of file index.c.
Referenced by EstimateReindexStateSpace(), ReindexIsProcessingIndex(), RemoveReindexPending(), ResetReindexState(), RestoreReindexState(), SerializeReindexState(), and SetReindexPending().
|
static |
Definition at line 4113 of file index.c.
Referenced by ResetReindexState(), RestoreReindexState(), SetReindexPending(), and SetReindexProcessing().