316 List *arbiterIndexes,
364 if (indexRelation ==
NULL)
413 (arbiterIndexes ==
NIL ||
415 indexRelation->
rd_index->indexrelid));
430 if (!indexRelation->
rd_index->indisunique)
434 else if (indexRelation->
rd_index->indimmediate)
483 else if (!indexRelation->
rd_index->indimmediate)
496 indexRelation, indexInfo,
588 if (indexRelation ==
NULL)
601 if (arbiterIndexes !=
NIL &&
603 indexRelation->
rd_index->indexrelid))
606 if (!indexRelation->
rd_index->indimmediate)
609 errmsg(
"ON CONFLICT does not support deferrable unique constraints/exclusion constraints as arbiters"),
649 values, isnull, estate,
false,
657 elog(
ERROR,
"unexpected failure to find arbiter index");
838 elog(
ERROR,
"found self tuple multiple times in index \"%s\"",
912 errmsg(
"could not create exclusion constraint \"%s\"",
915 errdetail(
"Key %s conflicts with key %s.",
923 errmsg(
"conflicting key value violates exclusion constraint \"%s\"",
926 errdetail(
"Key %s conflicts with existing key %s.",
928 errdetail(
"Key conflicts with existing key."),
947#ifdef USE_INJECTION_POINTS
993 index->rd_indcollation[
i],
1170 elog(
ERROR,
"WITHOUT OVERLAPS column \"%s\" is not a range or multirange",
1178 errmsg(
"empty WITHOUT OVERLAPS value found in column \"%s\" in relation \"%s\"",
void bms_free(Bitmapset *a)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
static Datum values[MAXATTR]
#define Assert(condition)
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
ExprState * ExecPrepareQual(List *qual, EState *estate)
static bool index_unchanged_by_update(ResultRelInfo *resultRelInfo, EState *estate, IndexInfo *indexInfo, Relation indexRelation)
void ExecCloseIndices(ResultRelInfo *resultRelInfo)
static bool index_recheck_constraint(Relation index, const Oid *constr_procs, const Datum *existing_values, const bool *existing_isnull, const Datum *new_values)
void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative)
@ CEOUC_LIVELOCK_PREVENTING_WAIT
static bool index_expression_changed_walker(Node *node, Bitmapset *allUpdatedCols)
List * ExecInsertIndexTuples(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool update, bool noDupErr, bool *specConflict, List *arbiterIndexes, bool onlySummarizing)
void check_exclusion_constraint(Relation heap, Relation index, IndexInfo *indexInfo, const ItemPointerData *tupleid, const Datum *values, const bool *isnull, EState *estate, bool newIndex)
static void ExecWithoutOverlapsNotEmpty(Relation rel, NameData attname, Datum attval, char typtype, Oid atttypid)
static bool check_exclusion_or_unique_constraint(Relation heap, Relation index, IndexInfo *indexInfo, const ItemPointerData *tupleid, const Datum *values, const bool *isnull, EState *estate, bool newIndex, CEOUC_WAIT_MODE waitMode, bool violationOK, ItemPointer conflictTid)
bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, ItemPointer conflictTid, const ItemPointerData *tupleid, List *arbiterIndexes)
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
Bitmapset * ExecGetExtraUpdatedCols(ResultRelInfo *relinfo, EState *estate)
Bitmapset * ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate)
#define GetPerTupleExprContext(estate)
static bool ExecQual(ExprState *state, ExprContext *econtext)
#define palloc_array(type, count)
Datum OidFunctionCall2Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2)
char * BuildIndexValueDescription(Relation indexRelation, const Datum *values, const bool *isnull)
IndexInfo * BuildIndexInfo(Relation index)
void BuildSpeculativeIndexInfo(Relation index, IndexInfo *ii)
void FormIndexDatum(IndexInfo *indexInfo, TupleTableSlot *slot, EState *estate, Datum *values, bool *isnull)
bool index_getnext_slot(IndexScanDesc scan, ScanDirection direction, TupleTableSlot *slot)
bool index_insert(Relation indexRelation, Datum *values, bool *isnull, ItemPointer heap_t_ctid, Relation heapRelation, IndexUniqueCheck checkUnique, bool indexUnchanged, IndexInfo *indexInfo)
IndexScanDesc index_beginscan(Relation heapRelation, Relation indexRelation, Snapshot snapshot, IndexScanInstrumentation *instrument, int nkeys, int norderbys)
void index_insert_cleanup(Relation indexRelation, IndexInfo *indexInfo)
void index_close(Relation relation, LOCKMODE lockmode)
void index_endscan(IndexScanDesc scan)
Relation index_open(Oid relationId, LOCKMODE lockmode)
void index_rescan(IndexScanDesc scan, ScanKey keys, int nkeys, ScanKey orderbys, int norderbys)
#define INJECTION_POINT(name, arg)
bool ItemPointerEquals(const ItemPointerData *pointer1, const ItemPointerData *pointer2)
static void ItemPointerSetInvalid(ItemPointerData *pointer)
static bool ItemPointerIsValid(const ItemPointerData *pointer)
List * lappend_oid(List *list, Oid datum)
void list_free(List *list)
bool list_member_oid(const List *list, Oid datum)
void SpeculativeInsertionWait(TransactionId xid, uint32 token)
void XactLockTableWait(TransactionId xid, Relation rel, const ItemPointerData *ctid, XLTW_Oper oper)
@ XLTW_RecheckExclusionConstr
#define MultirangeIsEmpty(mr)
static MultirangeType * DatumGetMultirangeTypeP(Datum X)
#define expression_tree_walker(n, w, c)
#define IsA(nodeptr, _type_)
FormData_pg_attribute * Form_pg_attribute
static int list_length(const List *l)
static bool DatumGetBool(Datum X)
static RangeType * DatumGetRangeTypeP(Datum X)
#define RelationGetForm(relation)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
#define IndexRelationGetNumberOfKeyAttributes(relation)
List * RelationGetIndexList(Relation relation)
int errtableconstraint(Relation rel, const char *conname)
List * RelationGetIndexExpressions(Relation relation)
void ScanKeyEntryInitialize(ScanKey entry, int flags, AttrNumber attributeNumber, StrategyNumber strategy, Oid subtype, Oid collation, RegProcedure procedure, Datum argument)
#define InitDirtySnapshot(snapshotdata)
TupleTableSlot * ecxt_scantuple
uint16 * ii_ExclusionStrats
ExprState * ii_PredicateState
AttrNumber ii_IndexAttrNumbers[INDEX_MAX_KEYS]
RelationPtr ri_IndexRelationDescs
IndexInfo ** ri_IndexRelationInfo
#define FirstLowInvalidHeapAttributeNumber
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
#define TransactionIdIsValid(xid)
static bool TransactionIdPrecedes(TransactionId id1, TransactionId id2)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)
TransactionId GetCurrentTransactionId(void)