PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/genam.h"
#include "access/relscan.h"
#include "access/tableam.h"
#include "access/xact.h"
#include "catalog/index.h"
#include "executor/executor.h"
#include "nodes/nodeFuncs.h"
#include "storage/lmgr.h"
#include "utils/multirangetypes.h"
#include "utils/rangetypes.h"
#include "utils/snapmgr.h"
Go to the source code of this file.
Enumerations | |
enum | CEOUC_WAIT_MODE { CEOUC_WAIT , CEOUC_NOWAIT , CEOUC_LIVELOCK_PREVENTING_WAIT } |
Functions | |
static bool | check_exclusion_or_unique_constraint (Relation heap, Relation index, IndexInfo *indexInfo, ItemPointer tupleid, const Datum *values, const bool *isnull, EState *estate, bool newIndex, CEOUC_WAIT_MODE waitMode, bool violationOK, ItemPointer conflictTid) |
static bool | index_recheck_constraint (Relation index, const Oid *constr_procs, const Datum *existing_values, const bool *existing_isnull, const Datum *new_values) |
static bool | index_unchanged_by_update (ResultRelInfo *resultRelInfo, EState *estate, IndexInfo *indexInfo, Relation indexRelation) |
static bool | index_expression_changed_walker (Node *node, Bitmapset *allUpdatedCols) |
static void | ExecWithoutOverlapsNotEmpty (Relation rel, NameData attname, Datum attval, char typtype, Oid atttypid) |
void | ExecOpenIndices (ResultRelInfo *resultRelInfo, bool speculative) |
void | ExecCloseIndices (ResultRelInfo *resultRelInfo) |
List * | ExecInsertIndexTuples (ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool update, bool noDupErr, bool *specConflict, List *arbiterIndexes, bool onlySummarizing) |
bool | ExecCheckIndexConstraints (ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, ItemPointer conflictTid, ItemPointer tupleid, List *arbiterIndexes) |
void | check_exclusion_constraint (Relation heap, Relation index, IndexInfo *indexInfo, ItemPointer tupleid, const Datum *values, const bool *isnull, EState *estate, bool newIndex) |
enum CEOUC_WAIT_MODE |
Enumerator | |
---|---|
CEOUC_WAIT | |
CEOUC_NOWAIT | |
CEOUC_LIVELOCK_PREVENTING_WAIT |
Definition at line 122 of file execIndexing.c.
void check_exclusion_constraint | ( | Relation | heap, |
Relation | index, | ||
IndexInfo * | indexInfo, | ||
ItemPointer | tupleid, | ||
const Datum * | values, | ||
const bool * | isnull, | ||
EState * | estate, | ||
bool | newIndex | ||
) |
Definition at line 950 of file execIndexing.c.
References CEOUC_WAIT, check_exclusion_or_unique_constraint(), and values.
Referenced by IndexCheckExclusion().
|
static |
Definition at line 698 of file execIndexing.c.
References BuildIndexValueDescription(), CEOUC_LIVELOCK_PREVENTING_WAIT, CEOUC_WAIT, ExprContext::ecxt_scantuple, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, errtableconstraint(), ExecDropSingleTupleTableSlot(), ExecWithoutOverlapsNotEmpty(), FormIndexDatum(), ForwardScanDirection, GetCurrentTransactionId(), GetPerTupleExprContext, i, IndexInfo::ii_ExclusionOps, IndexInfo::ii_ExclusionProcs, IndexInfo::ii_ExclusionStrats, IndexInfo::ii_IndexAttrNumbers, IndexInfo::ii_NullsNotDistinct, IndexInfo::ii_UniqueProcs, IndexInfo::ii_UniqueStrats, IndexInfo::ii_WithoutOverlaps, index_beginscan(), index_endscan(), index_getnext_slot(), INDEX_MAX_KEYS, index_recheck_constraint(), index_rescan(), IndexRelationGetNumberOfKeyAttributes, InitDirtySnapshot, InvalidOid, ItemPointerEquals(), ItemPointerIsValid(), lookup_type_cache(), RelationGetDescr, RelationGetRelationName, ScanKeyEntryInitialize(), SK_ISNULL, SK_SEARCHNULL, SpeculativeInsertionWait(), SnapshotData::speculativeToken, table_slot_create(), TransactionIdIsValid, TransactionIdPrecedes(), TupleTableSlot::tts_tid, TupleDescAttr, TypeCacheEntry::typtype, values, XactLockTableWait(), XLTW_InsertIndex, XLTW_RecheckExclusionConstr, SnapshotData::xmax, SnapshotData::xmin, and IndexScanDescData::xs_recheck.
Referenced by check_exclusion_constraint(), ExecCheckIndexConstraints(), and ExecInsertIndexTuples().
bool ExecCheckIndexConstraints | ( | ResultRelInfo * | resultRelInfo, |
TupleTableSlot * | slot, | ||
EState * | estate, | ||
ItemPointer | conflictTid, | ||
ItemPointer | tupleid, | ||
List * | arbiterIndexes | ||
) |
Definition at line 536 of file execIndexing.c.
References CEOUC_WAIT, check_exclusion_or_unique_constraint(), ExprContext::ecxt_scantuple, elog, ereport, errcode(), errmsg(), ERROR, errtableconstraint(), ExecPrepareQual(), ExecQual(), FormIndexDatum(), GetPerTupleExprContext, i, IndexInfo::ii_ExclusionOps, IndexInfo::ii_Predicate, IndexInfo::ii_PredicateState, IndexInfo::ii_ReadyForInserts, IndexInfo::ii_Unique, INDEX_MAX_KEYS, ItemPointerSetInvalid(), list_member_oid(), NIL, RelationData::rd_index, RelationGetRelationName, ResultRelInfo::ri_IndexRelationDescs, ResultRelInfo::ri_IndexRelationInfo, ResultRelInfo::ri_NumIndices, ResultRelInfo::ri_RelationDesc, and values.
Referenced by ExecInsert(), and FindConflictTuple().
void ExecCloseIndices | ( | ResultRelInfo * | resultRelInfo | ) |
Definition at line 236 of file execIndexing.c.
References i, index_close(), index_insert_cleanup(), ResultRelInfo::ri_IndexRelationDescs, ResultRelInfo::ri_IndexRelationInfo, ResultRelInfo::ri_NumIndices, and RowExclusiveLock.
Referenced by apply_handle_delete_internal(), apply_handle_insert_internal(), apply_handle_tuple_routing(), apply_handle_update_internal(), CatalogCloseIndexes(), ExecCleanupTupleRouting(), and ExecCloseResultRelations().
List* ExecInsertIndexTuples | ( | ResultRelInfo * | resultRelInfo, |
TupleTableSlot * | slot, | ||
EState * | estate, | ||
bool | update, | ||
bool | noDupErr, | ||
bool * | specConflict, | ||
List * | arbiterIndexes, | ||
bool | onlySummarizing | ||
) |
Definition at line 303 of file execIndexing.c.
References Assert, CEOUC_LIVELOCK_PREVENTING_WAIT, CEOUC_NOWAIT, CEOUC_WAIT, check_exclusion_or_unique_constraint(), ExprContext::ecxt_scantuple, ExecPrepareQual(), ExecQual(), FormIndexDatum(), GetPerTupleExprContext, i, IndexInfo::ii_ExclusionOps, IndexInfo::ii_Predicate, IndexInfo::ii_PredicateState, IndexInfo::ii_ReadyForInserts, IndexInfo::ii_Summarizing, index_insert(), INDEX_MAX_KEYS, index_unchanged_by_update(), ItemPointerIsValid(), lappend_oid(), list_member_oid(), NIL, RelationData::rd_index, RelationGetRelid, ResultRelInfo::ri_IndexRelationDescs, ResultRelInfo::ri_IndexRelationInfo, ResultRelInfo::ri_NumIndices, ResultRelInfo::ri_RelationDesc, TupleTableSlot::tts_tableOid, TupleTableSlot::tts_tid, UNIQUE_CHECK_NO, UNIQUE_CHECK_PARTIAL, UNIQUE_CHECK_YES, and values.
Referenced by CopyFrom(), CopyMultiInsertBufferFlush(), ExecInsert(), ExecSimpleRelationInsert(), ExecSimpleRelationUpdate(), and ExecUpdateEpilogue().
void ExecOpenIndices | ( | ResultRelInfo * | resultRelInfo, |
bool | speculative | ||
) |
Definition at line 160 of file execIndexing.c.
References BuildIndexInfo(), BuildSpeculativeIndexInfo(), i, IndexInfo::ii_Unique, index_open(), len, lfirst_oid, list_free(), list_length(), palloc(), RelationData::rd_index, RelationGetForm, RelationGetIndexList(), ResultRelInfo::ri_IndexRelationDescs, ResultRelInfo::ri_IndexRelationInfo, ResultRelInfo::ri_NumIndices, ResultRelInfo::ri_RelationDesc, and RowExclusiveLock.
Referenced by apply_handle_delete_internal(), apply_handle_insert_internal(), apply_handle_tuple_routing(), apply_handle_update_internal(), CatalogOpenIndexes(), CopyFrom(), ExecInitPartitionInfo(), ExecInsert(), and ExecUpdatePrologue().
|
static |
Definition at line 1141 of file execIndexing.c.
References attname, DatumGetMultirangeTypeP(), DatumGetRangeTypeP(), elog, ereport, errcode(), errmsg(), ERROR, MultirangeIsEmpty, NameStr, RangeIsEmpty, and RelationGetRelationName.
Referenced by check_exclusion_or_unique_constraint().
Definition at line 1112 of file execIndexing.c.
References bms_is_member(), expression_tree_walker, FirstLowInvalidHeapAttributeNumber, IsA, and Var::varattno.
Referenced by index_unchanged_by_update().
|
static |
Definition at line 967 of file execIndexing.c.
References DatumGetBool(), i, IndexRelationGetNumberOfKeyAttributes, and OidFunctionCall2Coll().
Referenced by check_exclusion_or_unique_constraint().
|
static |
Definition at line 998 of file execIndexing.c.
References bms_free(), bms_is_member(), bms_union(), ExecGetExtraUpdatedCols(), ExecGetUpdatedCols(), FirstLowInvalidHeapAttributeNumber, IndexInfo::ii_CheckedUnchanged, IndexInfo::ii_IndexAttrNumbers, IndexInfo::ii_IndexUnchanged, IndexInfo::ii_NumIndexKeyAttrs, index_expression_changed_walker(), list_free(), and RelationGetIndexExpressions().
Referenced by ExecInsertIndexTuples().