* The new tuple is stamped with current transaction ID and the specified
* command ID.
*
- * See table_insert for comments about most of the input flags, except that
- * this routine directly takes a tuple rather than a slot.
+ * See table_tuple_insert for comments about most of the input flags, except
+ * that this routine directly takes a tuple rather than a slot.
*
* There's corresponding HEAP_INSERT_ options to all the TABLE_INSERT_
* options, and there additionally is HEAP_INSERT_SPECULATIVE which is used to
- * implement table_insert_speculative().
+ * implement table_tuple_insert_speculative().
*
* On return the header fields of *tup are updated to match the stored tuple;
* in particular tup->t_self receives the actual TID where the tuple was
/*
* heap_delete - delete a tuple
*
- * See table_delete() for an explanation of the parameters, except that this
- * routine directly takes a tuple rather than a slot.
+ * See table_tuple_delete() for an explanation of the parameters, except that
+ * this routine directly takes a tuple rather than a slot.
*
* In the failure cases, the routine fills *tmfd with the tuple's t_ctid,
* t_xmax (resolving a possible MultiXact, if necessary), and t_cmax (the last
/*
* heap_update - replace a tuple
*
- * See table_update() for an explanation of the parameters, except that this
- * routine directly takes a tuple rather than a slot.
+ * See table_tuple_update() for an explanation of the parameters, except that
+ * this routine directly takes a tuple rather than a slot.
*
* In the failure cases, the routine fills *tmfd with the tuple's t_ctid,
* t_xmax (resolving a possible MultiXact, if necessary), and t_cmax (the last
* *buffer: set to buffer holding tuple (pinned but not locked at exit)
* *tmfd: filled in failure cases (see below)
*
- * Function results are the same as the ones for table_lock_tuple().
+ * Function results are the same as the ones for table_tuple_lock().
*
* In the failure cases other than TM_Invisible, the routine fills
* *tmfd with the tuple's t_ctid, t_xmax (resolving a possible MultiXact,
*/
void
-table_get_latest_tid(TableScanDesc scan, ItemPointer tid)
+table_tuple_get_latest_tid(TableScanDesc scan, ItemPointer tid)
{
Relation rel = scan->rs_rd;
const TableAmRoutine *tableam = rel->rd_tableam;
*/
/*
- * simple_table_insert - insert a tuple
+ * simple_table_tuple_insert - insert a tuple
*
- * Currently, this routine differs from table_insert only in supplying a
+ * Currently, this routine differs from table_tuple_insert only in supplying a
* default command ID and not allowing access to the speedup options.
*/
void
-simple_table_insert(Relation rel, TupleTableSlot *slot)
+simple_table_tuple_insert(Relation rel, TupleTableSlot *slot)
{
- table_insert(rel, slot, GetCurrentCommandId(true), 0, NULL);
+ table_tuple_insert(rel, slot, GetCurrentCommandId(true), 0, NULL);
}
/*
- * simple_table_delete - delete a tuple
+ * simple_table_tuple_delete - delete a tuple
*
* This routine may be used to delete a tuple when concurrent updates of
* the target tuple are not expected (for example, because we have a lock
* via ereport().
*/
void
-simple_table_delete(Relation rel, ItemPointer tid, Snapshot snapshot)
+simple_table_tuple_delete(Relation rel, ItemPointer tid, Snapshot snapshot)
{
TM_Result result;
TM_FailureData tmfd;
- result = table_delete(rel, tid,
- GetCurrentCommandId(true),
- snapshot, InvalidSnapshot,
- true /* wait for commit */ ,
- &tmfd, false /* changingPart */ );
+ result = table_tuple_delete(rel, tid,
+ GetCurrentCommandId(true),
+ snapshot, InvalidSnapshot,
+ true /* wait for commit */ ,
+ &tmfd, false /* changingPart */ );
switch (result)
{
break;
default:
- elog(ERROR, "unrecognized table_delete status: %u", result);
+ elog(ERROR, "unrecognized table_tuple_delete status: %u", result);
break;
}
}
/*
- * simple_table_update - replace a tuple
+ * simple_table_tuple_update - replace a tuple
*
* This routine may be used to update a tuple when concurrent updates of
* the target tuple are not expected (for example, because we have a lock
* via ereport().
*/
void
-simple_table_update(Relation rel, ItemPointer otid,
- TupleTableSlot *slot,
- Snapshot snapshot,
- bool *update_indexes)
+simple_table_tuple_update(Relation rel, ItemPointer otid,
+ TupleTableSlot *slot,
+ Snapshot snapshot,
+ bool *update_indexes)
{
TM_Result result;
TM_FailureData tmfd;
LockTupleMode lockmode;
- result = table_update(rel, otid, slot,
- GetCurrentCommandId(true),
- snapshot, InvalidSnapshot,
- true /* wait for commit */ ,
- &tmfd, &lockmode, update_indexes);
+ result = table_tuple_update(rel, otid, slot,
+ GetCurrentCommandId(true),
+ snapshot, InvalidSnapshot,
+ true /* wait for commit */ ,
+ &tmfd, &lockmode, update_indexes);
switch (result)
{
break;
default:
- elog(ERROR, "unrecognized table_update status: %u", result);
+ elog(ERROR, "unrecognized table_tuple_update status: %u", result);
break;
}
*/
typedef enum CopyInsertMethod
{
- CIM_SINGLE, /* use table_insert or fdw routine */
+ CIM_SINGLE, /* use table_tuple_insert or fdw routine */
CIM_MULTI, /* always use table_multi_insert */
CIM_MULTI_CONDITIONAL /* use table_multi_insert only if valid */
} CopyInsertMethod;
PartitionTupleRouting *proute = NULL;
ErrorContextCallback errcallback;
CommandId mycid = GetCurrentCommandId(true);
- int ti_options = 0; /* start with default table_insert options */
+ int ti_options = 0; /* start with default options for insert */
BulkInsertState bistate = NULL;
CopyInsertMethod insertMethod;
CopyMultiInsertInfo multiInsertInfo = {0}; /* pacify compiler */
* FSM for free space is a waste of time, even if we must use WAL because
* of archiving. This could possibly be wrong, but it's unlikely.
*
- * The comments for table_insert and RelationGetBufferForTuple specify that
- * skipping WAL logging is only safe if we ensure that our tuples do not
- * go into pages containing tuples from any other transactions --- but this
- * must be the case if we have a new table or new relfilenode, so we need
- * no additional work to enforce that.
+ * The comments for table_tuple_insert and RelationGetBufferForTuple
+ * specify that skipping WAL logging is only safe if we ensure that our
+ * tuples do not go into pages containing tuples from any other
+ * transactions --- but this must be the case if we have a new table or
+ * new relfilenode, so we need no additional work to enforce that.
*
* We currently don't support this optimization if the COPY target is a
* partitioned table as we currently only lazily initialize partition
/*
* It's generally more efficient to prepare a bunch of tuples for
* insertion, and insert them in one table_multi_insert() call, than call
- * table_insert() separately for every tuple. However, there are a number
- * of reasons why we might not be able to do this. These are explained
- * below.
+ * table_tuple_insert() separately for every tuple. However, there are a
+ * number of reasons why we might not be able to do this. These are
+ * explained below.
*/
if (resultRelInfo->ri_TrigDesc != NULL &&
(resultRelInfo->ri_TrigDesc->trig_insert_before_row ||
else
{
/* OK, store the tuple and create index entries for it */
- table_insert(resultRelInfo->ri_RelationDesc, myslot,
- mycid, ti_options, bistate);
+ table_tuple_insert(resultRelInfo->ri_RelationDesc,
+ myslot, mycid, ti_options, bistate);
if (resultRelInfo->ri_NumIndices > 0)
recheckIndexes = ExecInsertIndexTuples(myslot,
Relation rel; /* relation to write to */
ObjectAddress reladdr; /* address of rel, for ExecCreateTableAs */
CommandId output_cid; /* cmin to insert in output tuples */
- int ti_options; /* table_insert performance options */
+ int ti_options; /* table_tuple_insert performance options */
BulkInsertState bistate; /* bulk insert state */
} DR_intorel;
/*
* Note that the input slot might not be of the type of the target
- * relation. That's supported by table_insert(), but slightly less
+ * relation. That's supported by table_tuple_insert(), but slightly less
* efficient than inserting with the right slot - but the alternative
* would be to copy into a slot of the right type, which would not be
* cheap either. This also doesn't allow accessing per-AM data (say a
* tuple's xmin), but since we don't do that here...
*/
- table_insert(myState->rel,
- slot,
- myState->output_cid,
- myState->ti_options,
- myState->bistate);
+ table_tuple_insert(myState->rel,
+ slot,
+ myState->output_cid,
+ myState->ti_options,
+ myState->bistate);
/* We know this is a newly created relation, so there are no indexes */
/* These fields are filled by transientrel_startup: */
Relation transientrel; /* relation to write to */
CommandId output_cid; /* cmin to insert in output tuples */
- int ti_options; /* table_insert performance options */
+ int ti_options; /* table_tuple_insert performance options */
BulkInsertState bistate; /* bulk insert state */
} DR_transientrel;
/*
* Note that the input slot might not be of the type of the target
- * relation. That's supported by table_insert(), but slightly less
+ * relation. That's supported by table_tuple_insert(), but slightly less
* efficient than inserting with the right slot - but the alternative
* would be to copy into a slot of the right type, which would not be
* cheap either. This also doesn't allow accessing per-AM data (say a
* tuple's xmin), but since we don't do that here...
*/
- table_insert(myState->transientrel,
- slot,
- myState->output_cid,
- myState->ti_options,
- myState->bistate);
+ table_tuple_insert(myState->transientrel,
+ slot,
+ myState->output_cid,
+ myState->ti_options,
+ myState->bistate);
/* We know this is a newly created relation, so there are no indexes */
newrel = NULL;
/*
- * Prepare a BulkInsertState and options for table_insert. Because we're
- * building a new heap, we can skip WAL-logging and fsync it to disk at
- * the end instead (unless WAL-logging is required for archiving or
+ * Prepare a BulkInsertState and options for table_tuple_insert. Because
+ * we're building a new heap, we can skip WAL-logging and fsync it to disk
+ * at the end instead (unless WAL-logging is required for archiving or
* streaming replication). The FSM is empty too, so don't bother using it.
*/
if (newrel)
/* Write the tuple out to the new relation */
if (newrel)
- table_insert(newrel, insertslot, mycid, ti_options, bistate);
+ table_tuple_insert(newrel, insertslot, mycid,
+ ti_options, bistate);
ResetExprContext(econtext);
*/
if (!IsolationUsesXactSnapshot())
lockflags |= TUPLE_LOCK_FLAG_FIND_LAST_VERSION;
- test = table_lock_tuple(relation, tid, estate->es_snapshot, oldslot,
+ test = table_tuple_lock(relation, tid, estate->es_snapshot, oldslot,
estate->es_output_cid,
lockmode, LockWaitBlock,
lockflags,
ereport(ERROR,
(errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
errmsg("could not serialize access due to concurrent update")));
- elog(ERROR, "unexpected table_lock_tuple status: %u", test);
+ elog(ERROR, "unexpected table_tuple_lock status: %u", test);
break;
case TM_Deleted:
break;
default:
- elog(ERROR, "unrecognized table_lock_tuple status: %u", test);
+ elog(ERROR, "unrecognized table_tuple_lock status: %u", test);
return false; /* keep compiler quiet */
}
}
* We expect the tuple to be present, thus very simple error handling
* suffices.
*/
- if (!table_fetch_row_version(relation, tid, SnapshotAny, oldslot))
+ if (!table_tuple_fetch_row_version(relation, tid, SnapshotAny,
+ oldslot))
elog(ERROR, "failed to fetch tuple for trigger");
}
{
LocTriggerData.tg_trigslot = ExecGetTriggerOldSlot(estate, relInfo);
- if (!table_fetch_row_version(rel, &(event->ate_ctid1), SnapshotAny, LocTriggerData.tg_trigslot))
+ if (!table_tuple_fetch_row_version(rel, &(event->ate_ctid1),
+ SnapshotAny,
+ LocTriggerData.tg_trigslot))
elog(ERROR, "failed to fetch tuple1 for AFTER trigger");
LocTriggerData.tg_trigtuple =
ExecFetchSlotHeapTuple(LocTriggerData.tg_trigslot, false, &should_free_trig);
{
LocTriggerData.tg_newslot = ExecGetTriggerNewSlot(estate, relInfo);
- if (!table_fetch_row_version(rel, &(event->ate_ctid2), SnapshotAny, LocTriggerData.tg_newslot))
+ if (!table_tuple_fetch_row_version(rel, &(event->ate_ctid2),
+ SnapshotAny,
+ LocTriggerData.tg_newslot))
elog(ERROR, "failed to fetch tuple2 for AFTER trigger");
LocTriggerData.tg_newtuple =
ExecFetchSlotHeapTuple(LocTriggerData.tg_newslot, false, &should_free_new);
* quals. For that result to be useful, typically the input tuple has to be
* last row version (otherwise the result isn't particularly useful) and
* locked (otherwise the result might be out of date). That's typically
- * achieved by using table_lock_tuple() with the
+ * achieved by using table_tuple_lock() with the
* TUPLE_LOCK_FLAG_FIND_LAST_VERSION flag.
*
* Returns a slot containing the new candidate update/delete tuple, or
else
{
/* ordinary table, fetch the tuple */
- if (!table_fetch_row_version(erm->relation,
- (ItemPointer) DatumGetPointer(datum),
- SnapshotAny, slot))
+ if (!table_tuple_fetch_row_version(erm->relation,
+ (ItemPointer) DatumGetPointer(datum),
+ SnapshotAny, slot))
elog(ERROR, "failed to fetch tuple for EvalPlanQual recheck");
}
}
PushActiveSnapshot(GetLatestSnapshot());
- res = table_lock_tuple(rel, &(outslot->tts_tid), GetLatestSnapshot(),
+ res = table_tuple_lock(rel, &(outslot->tts_tid), GetLatestSnapshot(),
outslot,
GetCurrentCommandId(false),
lockmode,
elog(ERROR, "attempted to lock invisible tuple");
break;
default:
- elog(ERROR, "unexpected table_lock_tuple status: %u", res);
+ elog(ERROR, "unexpected table_tuple_lock status: %u", res);
break;
}
}
PushActiveSnapshot(GetLatestSnapshot());
- res = table_lock_tuple(rel, &(outslot->tts_tid), GetLatestSnapshot(),
+ res = table_tuple_lock(rel, &(outslot->tts_tid), GetLatestSnapshot(),
outslot,
GetCurrentCommandId(false),
lockmode,
elog(ERROR, "attempted to lock invisible tuple");
break;
default:
- elog(ERROR, "unexpected table_lock_tuple status: %u", res);
+ elog(ERROR, "unexpected table_tuple_lock status: %u", res);
break;
}
}
ExecPartitionCheck(resultRelInfo, slot, estate, true);
/* OK, store the tuple and create index entries for it */
- simple_table_insert(resultRelInfo->ri_RelationDesc, slot);
+ simple_table_tuple_insert(resultRelInfo->ri_RelationDesc, slot);
if (resultRelInfo->ri_NumIndices > 0)
recheckIndexes = ExecInsertIndexTuples(slot, estate, false, NULL,
if (resultRelInfo->ri_PartitionCheck)
ExecPartitionCheck(resultRelInfo, slot, estate, true);
- simple_table_update(rel, tid, slot, estate->es_snapshot,
- &update_indexes);
+ simple_table_tuple_update(rel, tid, slot, estate->es_snapshot,
+ &update_indexes);
if (resultRelInfo->ri_NumIndices > 0 && update_indexes)
recheckIndexes = ExecInsertIndexTuples(slot, estate, false, NULL,
if (!skip_tuple)
{
/* OK, delete the tuple */
- simple_table_delete(rel, tid, estate->es_snapshot);
+ simple_table_tuple_delete(rel, tid, estate->es_snapshot);
/* AFTER ROW DELETE Triggers */
ExecARDeleteTriggers(estate, resultRelInfo,
if (!IsolationUsesXactSnapshot())
lockflags |= TUPLE_LOCK_FLAG_FIND_LAST_VERSION;
- test = table_lock_tuple(erm->relation, &tid, estate->es_snapshot,
+ test = table_tuple_lock(erm->relation, &tid, estate->es_snapshot,
markSlot, estate->es_output_cid,
lockmode, erm->waitPolicy,
lockflags,
* to fetch the updated tuple instead, but doing so would
* require changing heap_update and heap_delete to not
* complain about updating "invisible" tuples, which seems
- * pretty scary (table_lock_tuple will not complain, but few
+ * pretty scary (table_tuple_lock will not complain, but few
* callers expect TM_Invisible, and we're not one of them). So
* for now, treat the tuple as deleted and do not process.
*/
ereport(ERROR,
(errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
errmsg("could not serialize access due to concurrent update")));
- elog(ERROR, "unexpected table_lock_tuple status: %u",
+ elog(ERROR, "unexpected table_tuple_lock status: %u",
test);
break;
break;
default:
- elog(ERROR, "unrecognized table_lock_tuple status: %u",
+ elog(ERROR, "unrecognized table_tuple_lock status: %u",
test);
}
if (!IsolationUsesXactSnapshot())
return;
- if (!table_fetch_row_version(rel, tid, SnapshotAny, tempSlot))
+ if (!table_tuple_fetch_row_version(rel, tid, SnapshotAny, tempSlot))
elog(ERROR, "failed to fetch conflicting tuple for ON CONFLICT");
ExecCheckTupleVisible(estate, rel, tempSlot);
ExecClearTuple(tempSlot);
specToken = SpeculativeInsertionLockAcquire(GetCurrentTransactionId());
/* insert the tuple, with the speculative token */
- table_insert_speculative(resultRelationDesc, slot,
- estate->es_output_cid,
- 0,
- NULL,
- specToken);
+ table_tuple_insert_speculative(resultRelationDesc, slot,
+ estate->es_output_cid,
+ 0,
+ NULL,
+ specToken);
/* insert index entries for tuple */
recheckIndexes = ExecInsertIndexTuples(slot, estate, true,
arbiterIndexes);
/* adjust the tuple's state accordingly */
- table_complete_speculative(resultRelationDesc, slot,
- specToken, !specConflict);
+ table_tuple_complete_speculative(resultRelationDesc, slot,
+ specToken, !specConflict);
/*
* Wake up anyone waiting for our decision. They will re-check
else
{
/* insert the tuple normally */
- table_insert(resultRelationDesc, slot,
- estate->es_output_cid,
- 0, NULL);
+ table_tuple_insert(resultRelationDesc, slot,
+ estate->es_output_cid,
+ 0, NULL);
/* insert index entries for tuple */
if (resultRelInfo->ri_NumIndices > 0)
* mode transactions.
*/
ldelete:;
- result = table_delete(resultRelationDesc, tupleid,
- estate->es_output_cid,
- estate->es_snapshot,
- estate->es_crosscheck_snapshot,
- true /* wait for commit */ ,
- &tmfd,
- changingPart);
+ result = table_tuple_delete(resultRelationDesc, tupleid,
+ estate->es_output_cid,
+ estate->es_snapshot,
+ estate->es_crosscheck_snapshot,
+ true /* wait for commit */ ,
+ &tmfd,
+ changingPart);
switch (result)
{
inputslot = EvalPlanQualSlot(epqstate, resultRelationDesc,
resultRelInfo->ri_RangeTableIndex);
- result = table_lock_tuple(resultRelationDesc, tupleid,
+ result = table_tuple_lock(resultRelationDesc, tupleid,
estate->es_snapshot,
inputslot, estate->es_output_cid,
LockTupleExclusive, LockWaitBlock,
* out.
*
* See also TM_SelfModified response to
- * table_delete() above.
+ * table_tuple_delete() above.
*/
if (tmfd.cmax != estate->es_output_cid)
ereport(ERROR,
* locking the latest version via
* TUPLE_LOCK_FLAG_FIND_LAST_VERSION.
*/
- elog(ERROR, "unexpected table_lock_tuple status: %u",
+ elog(ERROR, "unexpected table_tuple_lock status: %u",
result);
return NULL;
}
return NULL;
default:
- elog(ERROR, "unrecognized table_delete status: %u", result);
+ elog(ERROR, "unrecognized table_tuple_delete status: %u",
+ result);
return NULL;
}
}
else
{
- if (!table_fetch_row_version(resultRelationDesc, tupleid,
- SnapshotAny, slot))
+ if (!table_tuple_fetch_row_version(resultRelationDesc, tupleid,
+ SnapshotAny, slot))
elog(ERROR, "failed to fetch deleted tuple for DELETE RETURNING");
}
}
* If we generate a new candidate tuple after EvalPlanQual testing, we
* must loop back here and recheck any RLS policies and constraints.
* (We don't need to redo triggers, however. If there are any BEFORE
- * triggers then trigger.c will have done table_lock_tuple to lock the
+ * triggers then trigger.c will have done table_tuple_lock to lock the
* correct tuple, so there's no need to do them again.)
*/
lreplace:;
* needed for referential integrity updates in transaction-snapshot
* mode transactions.
*/
- result = table_update(resultRelationDesc, tupleid, slot,
- estate->es_output_cid,
- estate->es_snapshot,
- estate->es_crosscheck_snapshot,
- true /* wait for commit */ ,
- &tmfd, &lockmode, &update_indexes);
+ result = table_tuple_update(resultRelationDesc, tupleid, slot,
+ estate->es_output_cid,
+ estate->es_snapshot,
+ estate->es_crosscheck_snapshot,
+ true /* wait for commit */ ,
+ &tmfd, &lockmode, &update_indexes);
switch (result)
{
inputslot = EvalPlanQualSlot(epqstate, resultRelationDesc,
resultRelInfo->ri_RangeTableIndex);
- result = table_lock_tuple(resultRelationDesc, tupleid,
+ result = table_tuple_lock(resultRelationDesc, tupleid,
estate->es_snapshot,
inputslot, estate->es_output_cid,
lockmode, LockWaitBlock,
* otherwise error out.
*
* See also TM_SelfModified response to
- * table_update() above.
+ * table_tuple_update() above.
*/
if (tmfd.cmax != estate->es_output_cid)
ereport(ERROR,
return NULL;
default:
- /* see table_lock_tuple call in ExecDelete() */
- elog(ERROR, "unexpected table_lock_tuple status: %u",
+ /* see table_tuple_lock call in ExecDelete() */
+ elog(ERROR, "unexpected table_tuple_lock status: %u",
result);
return NULL;
}
return NULL;
default:
- elog(ERROR, "unrecognized table_update status: %u", result);
+ elog(ERROR, "unrecognized table_tuple_update status: %u",
+ result);
return NULL;
}
* previous conclusion that the tuple is conclusively committed is not
* true anymore.
*/
- test = table_lock_tuple(relation, conflictTid,
+ test = table_tuple_lock(relation, conflictTid,
estate->es_snapshot,
existing, estate->es_output_cid,
lockmode, LockWaitBlock, 0,
return false;
default:
- elog(ERROR, "unrecognized table_lock_tuple status: %u", test);
+ elog(ERROR, "unrecognized table_tuple_lock status: %u", test);
}
/* Success, the tuple is locked. */
/*
* Note that it is possible that the target tuple has been modified in
- * this session, after the above table_lock_tuple. We choose to not error
+ * this session, after the above table_tuple_lock. We choose to not error
* out in that case, in line with ExecUpdate's treatment of similar cases.
* This can happen if an UPDATE is triggered from within ExecQual(),
* ExecWithCheckOptions() or ExecProject() above, e.g. by selecting from a
* current according to our snapshot.
*/
if (node->tss_isCurrentOf)
- table_get_latest_tid(scan, &tid);
+ table_tuple_get_latest_tid(scan, &tid);
- if (table_fetch_row_version(heapRelation, &tid, snapshot, slot))
+ if (table_tuple_fetch_row_version(heapRelation, &tid, snapshot, slot))
return slot;
/* Bad TID or failed snapshot qual; try next */
snapshot = RegisterSnapshot(GetLatestSnapshot());
scan = table_beginscan(rel, snapshot, 0, NULL);
- table_get_latest_tid(scan, result);
+ table_tuple_get_latest_tid(scan, result);
table_endscan(scan);
UnregisterSnapshot(snapshot);
snapshot = RegisterSnapshot(GetLatestSnapshot());
scan = table_beginscan(rel, snapshot, 0, NULL);
- table_get_latest_tid(scan, result);
+ table_tuple_get_latest_tid(scan, result);
table_endscan(scan);
UnregisterSnapshot(snapshot);
} TM_Result;
/*
- * When table_update, table_delete, or table_lock_tuple fail because the target
- * tuple is already outdated, they fill in this struct to provide information
- * to the caller about what happened.
+ * When table_tuple_update, table_tuple_delete, or table_tuple_lock fail
+ * because the target tuple is already outdated, they fill in this struct to
+ * provide information to the caller about what happened.
*
* ctid is the target's ctid link: it is the same as the target's TID if the
* target was deleted, or the location of the replacement tuple if the target
bool traversed;
} TM_FailureData;
-/* "options" flag bits for table_insert */
+/* "options" flag bits for table_tuple_insert */
#define TABLE_INSERT_SKIP_WAL 0x0001
#define TABLE_INSERT_SKIP_FSM 0x0002
#define TABLE_INSERT_FROZEN 0x0004
#define TABLE_INSERT_NO_LOGICAL 0x0008
-/* flag bits for table_lock_tuple */
+/* flag bits for table_tuple_lock */
/* Follow tuples whose update is in progress if lock modes don't conflict */
#define TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS (1 << 0)
/* Follow update chain and lock latest version of tuple */
* ------------------------------------------------------------------------
*/
- /* see table_insert() for reference about parameters */
+ /* see table_tuple_insert() for reference about parameters */
void (*tuple_insert) (Relation rel, TupleTableSlot *slot,
CommandId cid, int options,
struct BulkInsertStateData *bistate);
- /* see table_insert_speculative() for reference about parameters */
+ /* see table_tuple_insert_speculative() for reference about parameters */
void (*tuple_insert_speculative) (Relation rel,
TupleTableSlot *slot,
CommandId cid,
struct BulkInsertStateData *bistate,
uint32 specToken);
- /* see table_complete_speculative() for reference about parameters */
+ /* see table_tuple_complete_speculative() for reference about parameters */
void (*tuple_complete_speculative) (Relation rel,
TupleTableSlot *slot,
uint32 specToken,
void (*multi_insert) (Relation rel, TupleTableSlot **slots, int nslots,
CommandId cid, int options, struct BulkInsertStateData *bistate);
- /* see table_delete() for reference about parameters */
+ /* see table_tuple_delete() for reference about parameters */
TM_Result (*tuple_delete) (Relation rel,
ItemPointer tid,
CommandId cid,
TM_FailureData *tmfd,
bool changingPart);
- /* see table_update() for reference about parameters */
+ /* see table_tuple_update() for reference about parameters */
TM_Result (*tuple_update) (Relation rel,
ItemPointer otid,
TupleTableSlot *slot,
LockTupleMode *lockmode,
bool *update_indexes);
- /* see table_lock_tuple() for reference about parameters */
+ /* see table_tuple_lock() for reference about parameters */
TM_Result (*tuple_lock) (Relation rel,
ItemPointer tid,
Snapshot snapshot,
* supports storing multiple row versions reachable via a single index entry
* (like heap's HOT). Whereas table_fetch_row_version only evaluates the
* tuple exactly at `tid`. Outside of index entry ->table tuple lookups,
- * table_fetch_row_version is what's usually needed.
+ * table_tuple_fetch_row_version is what's usually needed.
*/
static inline bool
table_index_fetch_tuple(struct IndexFetchTableData *scan,
* index entry->table tuple lookups.
*/
static inline bool
-table_fetch_row_version(Relation rel,
- ItemPointer tid,
- Snapshot snapshot,
- TupleTableSlot *slot)
+table_tuple_fetch_row_version(Relation rel,
+ ItemPointer tid,
+ Snapshot snapshot,
+ TupleTableSlot *slot)
{
return rel->rd_tableam->tuple_fetch_row_version(rel, tid, snapshot, slot);
}
* Return the latest version of the tuple at `tid`, by updating `tid` to
* point at the newest version.
*/
-extern void table_get_latest_tid(TableScanDesc scan, ItemPointer tid);
+extern void table_tuple_get_latest_tid(TableScanDesc scan, ItemPointer tid);
/*
* Return true iff tuple in slot satisfies the snapshot.
* reflected in the slots contents.
*/
static inline void
-table_insert(Relation rel, TupleTableSlot *slot, CommandId cid,
- int options, struct BulkInsertStateData *bistate)
+table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid,
+ int options, struct BulkInsertStateData *bistate)
{
rel->rd_tableam->tuple_insert(rel, slot, cid, options,
bistate);
*
* A transaction having performed a speculative insertion has to either abort,
* or finish the speculative insertion with
- * table_complete_speculative(succeeded = ...).
+ * table_tuple_complete_speculative(succeeded = ...).
*/
static inline void
-table_insert_speculative(Relation rel, TupleTableSlot *slot, CommandId cid,
- int options, struct BulkInsertStateData *bistate,
- uint32 specToken)
+table_tuple_insert_speculative(Relation rel, TupleTableSlot *slot,
+ CommandId cid, int options,
+ struct BulkInsertStateData *bistate,
+ uint32 specToken)
{
rel->rd_tableam->tuple_insert_speculative(rel, slot, cid, options,
bistate, specToken);
* succeeded is true, the tuple is fully inserted, if false, it's removed.
*/
static inline void
-table_complete_speculative(Relation rel, TupleTableSlot *slot,
- uint32 specToken, bool succeeded)
+table_tuple_complete_speculative(Relation rel, TupleTableSlot *slot,
+ uint32 specToken, bool succeeded)
{
rel->rd_tableam->tuple_complete_speculative(rel, slot, specToken,
succeeded);
*
* Except for taking `nslots` tuples as input, as an array of TupleTableSlots
* in `slots`, the parameters for table_multi_insert() are the same as for
- * table_insert().
+ * table_tuple_insert().
*
* Note: this leaks memory into the current memory context. You can create a
* temporary context before calling this, if that's a problem.
* Delete a tuple.
*
* NB: do not call this directly unless prepared to deal with
- * concurrent-update conditions. Use simple_table_delete instead.
+ * concurrent-update conditions. Use simple_table_tuple_delete instead.
*
* Input parameters:
* relation - table to be modified (caller must hold suitable lock)
* struct TM_FailureData for additional info.
*/
static inline TM_Result
-table_delete(Relation rel, ItemPointer tid, CommandId cid,
- Snapshot snapshot, Snapshot crosscheck, bool wait,
- TM_FailureData *tmfd, bool changingPart)
+table_tuple_delete(Relation rel, ItemPointer tid, CommandId cid,
+ Snapshot snapshot, Snapshot crosscheck, bool wait,
+ TM_FailureData *tmfd, bool changingPart)
{
return rel->rd_tableam->tuple_delete(rel, tid, cid,
snapshot, crosscheck,
* Update a tuple.
*
* NB: do not call this directly unless you are prepared to deal with
- * concurrent-update conditions. Use simple_table_update instead.
+ * concurrent-update conditions. Use simple_table_tuple_update instead.
*
* Input parameters:
* relation - table to be modified (caller must hold suitable lock)
* for additional info.
*/
static inline TM_Result
-table_update(Relation rel, ItemPointer otid, TupleTableSlot *slot,
- CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait,
- TM_FailureData *tmfd, LockTupleMode *lockmode,
- bool *update_indexes)
+table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot,
+ CommandId cid, Snapshot snapshot, Snapshot crosscheck,
+ bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode,
+ bool *update_indexes)
{
return rel->rd_tableam->tuple_update(rel, otid, slot,
cid, snapshot, crosscheck,
* comments for struct TM_FailureData for additional info.
*/
static inline TM_Result
-table_lock_tuple(Relation rel, ItemPointer tid, Snapshot snapshot,
+table_tuple_lock(Relation rel, ItemPointer tid, Snapshot snapshot,
TupleTableSlot *slot, CommandId cid, LockTupleMode mode,
LockWaitPolicy wait_policy, uint8 flags,
TM_FailureData *tmfd)
* ----------------------------------------------------------------------------
*/
-extern void simple_table_insert(Relation rel, TupleTableSlot *slot);
-extern void simple_table_delete(Relation rel, ItemPointer tid,
- Snapshot snapshot);
-extern void simple_table_update(Relation rel, ItemPointer otid,
- TupleTableSlot *slot, Snapshot snapshot,
- bool *update_indexes);
+extern void simple_table_tuple_insert(Relation rel, TupleTableSlot *slot);
+extern void simple_table_tuple_delete(Relation rel, ItemPointer tid,
+ Snapshot snapshot);
+extern void simple_table_tuple_update(Relation rel, ItemPointer otid,
+ TupleTableSlot *slot, Snapshot snapshot,
+ bool *update_indexes);
/* ----------------------------------------------------------------------------