PostgreSQL Source Code  git master
tuptable.h File Reference
#include "access/htup.h"
#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/tupdesc.h"
#include "storage/buf.h"
Include dependency graph for tuptable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TupleTableSlot
 
struct  TupleTableSlotOps
 
struct  VirtualTupleTableSlot
 
struct  HeapTupleTableSlot
 
struct  BufferHeapTupleTableSlot
 
struct  MinimalTupleTableSlot
 

Macros

#define TTS_FLAG_EMPTY   (1 << 1)
 
#define TTS_EMPTY(slot)   (((slot)->tts_flags & TTS_FLAG_EMPTY) != 0)
 
#define TTS_FLAG_SHOULDFREE   (1 << 2)
 
#define TTS_SHOULDFREE(slot)   (((slot)->tts_flags & TTS_FLAG_SHOULDFREE) != 0)
 
#define TTS_FLAG_SLOW   (1 << 3)
 
#define TTS_SLOW(slot)   (((slot)->tts_flags & TTS_FLAG_SLOW) != 0)
 
#define TTS_FLAG_FIXED   (1 << 4)
 
#define TTS_FIXED(slot)   (((slot)->tts_flags & TTS_FLAG_FIXED) != 0)
 
#define FIELDNO_TUPLETABLESLOT_FLAGS   1
 
#define FIELDNO_TUPLETABLESLOT_NVALID   2
 
#define FIELDNO_TUPLETABLESLOT_TUPLEDESCRIPTOR   4
 
#define FIELDNO_TUPLETABLESLOT_VALUES   5
 
#define FIELDNO_TUPLETABLESLOT_ISNULL   6
 
#define TTS_IS_VIRTUAL(slot)   ((slot)->tts_ops == &TTSOpsVirtual)
 
#define TTS_IS_HEAPTUPLE(slot)   ((slot)->tts_ops == &TTSOpsHeapTuple)
 
#define TTS_IS_MINIMALTUPLE(slot)   ((slot)->tts_ops == &TTSOpsMinimalTuple)
 
#define TTS_IS_BUFFERTUPLE(slot)   ((slot)->tts_ops == &TTSOpsBufferHeapTuple)
 
#define FIELDNO_HEAPTUPLETABLESLOT_TUPLE   1
 
#define FIELDNO_HEAPTUPLETABLESLOT_OFF   2
 
#define FIELDNO_MINIMALTUPLETABLESLOT_TUPLE   1
 
#define FIELDNO_MINIMALTUPLETABLESLOT_OFF   4
 
#define TupIsNull(slot)    ((slot) == NULL || TTS_EMPTY(slot))
 

Typedefs

typedef struct TupleTableSlotOps TupleTableSlotOps
 
typedef struct TupleTableSlot TupleTableSlot
 
typedef struct VirtualTupleTableSlot VirtualTupleTableSlot
 
typedef struct HeapTupleTableSlot HeapTupleTableSlot
 
typedef struct BufferHeapTupleTableSlot BufferHeapTupleTableSlot
 
typedef struct MinimalTupleTableSlot MinimalTupleTableSlot
 

Functions

TupleTableSlotMakeTupleTableSlot (TupleDesc tupleDesc, const TupleTableSlotOps *tts_ops)
 
TupleTableSlotExecAllocTableSlot (List **tupleTable, TupleDesc desc, const TupleTableSlotOps *tts_ops)
 
void ExecResetTupleTable (List *tupleTable, bool shouldFree)
 
TupleTableSlotMakeSingleTupleTableSlot (TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
 
void ExecDropSingleTupleTableSlot (TupleTableSlot *slot)
 
void ExecSetSlotDescriptor (TupleTableSlot *slot, TupleDesc tupdesc)
 
TupleTableSlotExecStoreHeapTuple (HeapTuple tuple, TupleTableSlot *slot, bool shouldFree)
 
void ExecForceStoreHeapTuple (HeapTuple tuple, TupleTableSlot *slot, bool shouldFree)
 
TupleTableSlotExecStoreBufferHeapTuple (HeapTuple tuple, TupleTableSlot *slot, Buffer buffer)
 
TupleTableSlotExecStorePinnedBufferHeapTuple (HeapTuple tuple, TupleTableSlot *slot, Buffer buffer)
 
TupleTableSlotExecStoreMinimalTuple (MinimalTuple mtup, TupleTableSlot *slot, bool shouldFree)
 
void ExecForceStoreMinimalTuple (MinimalTuple mtup, TupleTableSlot *slot, bool shouldFree)
 
TupleTableSlotExecStoreVirtualTuple (TupleTableSlot *slot)
 
TupleTableSlotExecStoreAllNullTuple (TupleTableSlot *slot)
 
void ExecStoreHeapTupleDatum (Datum data, TupleTableSlot *slot)
 
HeapTuple ExecFetchSlotHeapTuple (TupleTableSlot *slot, bool materialize, bool *shouldFree)
 
MinimalTuple ExecFetchSlotMinimalTuple (TupleTableSlot *slot, bool *shouldFree)
 
Datum ExecFetchSlotHeapTupleDatum (TupleTableSlot *slot)
 
void slot_getmissingattrs (TupleTableSlot *slot, int startAttNum, int lastAttNum)
 
void slot_getsomeattrs_int (TupleTableSlot *slot, int attnum)
 
static void slot_getsomeattrs (TupleTableSlot *slot, int attnum)
 
static void slot_getallattrs (TupleTableSlot *slot)
 
static bool slot_attisnull (TupleTableSlot *slot, int attnum)
 
static Datum slot_getattr (TupleTableSlot *slot, int attnum, bool *isnull)
 
static Datum slot_getsysattr (TupleTableSlot *slot, int attnum, bool *isnull)
 
static bool slot_is_current_xact_tuple (TupleTableSlot *slot)
 
static TupleTableSlotExecClearTuple (TupleTableSlot *slot)
 
static void ExecMaterializeSlot (TupleTableSlot *slot)
 
static HeapTuple ExecCopySlotHeapTuple (TupleTableSlot *slot)
 
static MinimalTuple ExecCopySlotMinimalTuple (TupleTableSlot *slot)
 
static TupleTableSlotExecCopySlot (TupleTableSlot *dstslot, TupleTableSlot *srcslot)
 

Variables

PGDLLIMPORT const TupleTableSlotOps TTSOpsVirtual
 
PGDLLIMPORT const TupleTableSlotOps TTSOpsHeapTuple
 
PGDLLIMPORT const TupleTableSlotOps TTSOpsMinimalTuple
 
PGDLLIMPORT const TupleTableSlotOps TTSOpsBufferHeapTuple
 

Macro Definition Documentation

◆ FIELDNO_HEAPTUPLETABLESLOT_OFF

#define FIELDNO_HEAPTUPLETABLESLOT_OFF   2

Definition at line 261 of file tuptable.h.

◆ FIELDNO_HEAPTUPLETABLESLOT_TUPLE

#define FIELDNO_HEAPTUPLETABLESLOT_TUPLE   1

Definition at line 259 of file tuptable.h.

◆ FIELDNO_MINIMALTUPLETABLESLOT_OFF

#define FIELDNO_MINIMALTUPLETABLESLOT_OFF   4

Definition at line 299 of file tuptable.h.

◆ FIELDNO_MINIMALTUPLETABLESLOT_TUPLE

#define FIELDNO_MINIMALTUPLETABLESLOT_TUPLE   1

Definition at line 295 of file tuptable.h.

◆ FIELDNO_TUPLETABLESLOT_FLAGS

#define FIELDNO_TUPLETABLESLOT_FLAGS   1

Definition at line 117 of file tuptable.h.

◆ FIELDNO_TUPLETABLESLOT_ISNULL

#define FIELDNO_TUPLETABLESLOT_ISNULL   6

Definition at line 126 of file tuptable.h.

◆ FIELDNO_TUPLETABLESLOT_NVALID

#define FIELDNO_TUPLETABLESLOT_NVALID   2

Definition at line 119 of file tuptable.h.

◆ FIELDNO_TUPLETABLESLOT_TUPLEDESCRIPTOR

#define FIELDNO_TUPLETABLESLOT_TUPLEDESCRIPTOR   4

Definition at line 122 of file tuptable.h.

◆ FIELDNO_TUPLETABLESLOT_VALUES

#define FIELDNO_TUPLETABLESLOT_VALUES   5

Definition at line 124 of file tuptable.h.

◆ TTS_EMPTY

#define TTS_EMPTY (   slot)    (((slot)->tts_flags & TTS_FLAG_EMPTY) != 0)

Definition at line 96 of file tuptable.h.

◆ TTS_FIXED

#define TTS_FIXED (   slot)    (((slot)->tts_flags & TTS_FLAG_FIXED) != 0)

Definition at line 108 of file tuptable.h.

◆ TTS_FLAG_EMPTY

#define TTS_FLAG_EMPTY   (1 << 1)

Definition at line 95 of file tuptable.h.

◆ TTS_FLAG_FIXED

#define TTS_FLAG_FIXED   (1 << 4)

Definition at line 107 of file tuptable.h.

◆ TTS_FLAG_SHOULDFREE

#define TTS_FLAG_SHOULDFREE   (1 << 2)

Definition at line 99 of file tuptable.h.

◆ TTS_FLAG_SLOW

#define TTS_FLAG_SLOW   (1 << 3)

Definition at line 103 of file tuptable.h.

◆ TTS_IS_BUFFERTUPLE

#define TTS_IS_BUFFERTUPLE (   slot)    ((slot)->tts_ops == &TTSOpsBufferHeapTuple)

Definition at line 237 of file tuptable.h.

◆ TTS_IS_HEAPTUPLE

#define TTS_IS_HEAPTUPLE (   slot)    ((slot)->tts_ops == &TTSOpsHeapTuple)

Definition at line 235 of file tuptable.h.

◆ TTS_IS_MINIMALTUPLE

#define TTS_IS_MINIMALTUPLE (   slot)    ((slot)->tts_ops == &TTSOpsMinimalTuple)

Definition at line 236 of file tuptable.h.

◆ TTS_IS_VIRTUAL

#define TTS_IS_VIRTUAL (   slot)    ((slot)->tts_ops == &TTSOpsVirtual)

Definition at line 234 of file tuptable.h.

◆ TTS_SHOULDFREE

#define TTS_SHOULDFREE (   slot)    (((slot)->tts_flags & TTS_FLAG_SHOULDFREE) != 0)

Definition at line 100 of file tuptable.h.

◆ TTS_SLOW

#define TTS_SLOW (   slot)    (((slot)->tts_flags & TTS_FLAG_SLOW) != 0)

Definition at line 104 of file tuptable.h.

◆ TupIsNull

#define TupIsNull (   slot)     ((slot) == NULL || TTS_EMPTY(slot))

Definition at line 306 of file tuptable.h.

Typedef Documentation

◆ BufferHeapTupleTableSlot

◆ HeapTupleTableSlot

◆ MinimalTupleTableSlot

◆ TupleTableSlot

◆ TupleTableSlotOps

Definition at line 1 of file tuptable.h.

◆ VirtualTupleTableSlot

Function Documentation

◆ ExecAllocTableSlot()

TupleTableSlot* ExecAllocTableSlot ( List **  tupleTable,
TupleDesc  desc,
const TupleTableSlotOps tts_ops 
)

Definition at line 1258 of file execTuples.c.

1260 {
1261  TupleTableSlot *slot = MakeTupleTableSlot(desc, tts_ops);
1262 
1263  *tupleTable = lappend(*tupleTable, slot);
1264 
1265  return slot;
1266 }
TupleTableSlot * MakeTupleTableSlot(TupleDesc tupleDesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1199
List * lappend(List *list, void *datum)
Definition: list.c:339

References lappend(), and MakeTupleTableSlot().

Referenced by ExecInitExtraTupleSlot(), ExecInitIndexOnlyScan(), ExecInitResultSlot(), ExecInitScanTupleSlot(), and find_hash_columns().

◆ ExecClearTuple()

static TupleTableSlot* ExecClearTuple ( TupleTableSlot slot)
inlinestatic

Definition at line 454 of file tuptable.h.

455 {
456  slot->tts_ops->clear(slot);
457 
458  return slot;
459 }
void(* clear)(TupleTableSlot *slot)
Definition: tuptable.h:151
const TupleTableSlotOps *const tts_ops
Definition: tuptable.h:121

References TupleTableSlotOps::clear, and TupleTableSlot::tts_ops.

Referenced by AfterTriggerExecute(), agg_retrieve_hash_table_in_memory(), apply_handle_update_internal(), apply_returning_filter(), ATRewriteTable(), begin_partition(), BitmapHeapNext(), buildSubPlanHash(), check_publications(), check_publications_origin(), CopyFrom(), CopyMultiInsertBufferFlush(), copyTemplateDependencies(), CteScanNext(), DefineTSConfiguration(), do_tup_output(), EnumValuesCreate(), eval_windowaggregates(), EvalPlanQual(), ExecAppend(), ExecAppendAsyncGetNext(), ExecARUpdateTriggers(), ExecBatchInsert(), ExecCheckTIDVisible(), ExecComputeStoredGenerated(), ExecDelete(), ExecDropSingleTupleTableSlot(), ExecEvalAggOrderedTransTuple(), ExecEvalPreOrderedDistinctMulti(), ExecFilterJunk(), ExecFindPartition(), ExecForceStoreHeapTuple(), ExecForceStoreMinimalTuple(), ExecHashJoinGetSavedTuple(), ExecHashSubPlan(), ExecIncrementalSort(), ExecLockRows(), ExecMaterial(), ExecMergeAppend(), ExecOnConflictUpdate(), ExecParallelHashJoinOuterGetTuple(), ExecProject(), ExecProjectSRF(), ExecReScanAgg(), ExecReScanCteScan(), ExecReScanFunctionScan(), ExecReScanGroup(), ExecReScanIncrementalSort(), ExecReScanMaterial(), ExecReScanMergeJoin(), ExecReScanNamedTuplestoreScan(), ExecReScanSetOp(), ExecReScanSort(), ExecReScanTableFuncScan(), ExecReScanUnique(), ExecReScanValuesScan(), ExecReScanWindowAgg(), ExecReScanWorkTableScan(), ExecResetTupleTable(), ExecScan(), ExecScanFetch(), ExecScanReScan(), ExecSetSlotDescriptor(), ExecSort(), ExecStoreAllNullTuple(), ExecStoreHeapTupleDatum(), ExecUnique(), execute_attr_map_slot(), ExecWindowAgg(), fetch_remote_table_info(), fetch_table_list(), fileIterateForeignScan(), finalize_aggregates(), FunctionNext(), gather_getnext(), gather_merge_clear_tuples(), gather_merge_init(), get_actual_variable_endpoint(), get_returning_data(), hashagg_spill_tuple(), heap_getnextslot(), heap_getnextslot_tidrange(), heapam_scan_analyze_next_tuple(), heapam_scan_sample_next_tuple(), hypothetical_dense_rank_final(), hypothetical_rank_common(), IndexNext(), IndexNextWithReorder(), IndexOnlyNext(), InsertPgAttributeTuples(), MakeConfigurationMapping(), moveMergedTablesRows(), moveSplitTableRows(), ordered_set_shutdown(), ordered_set_transition_multi(), pgoutput_row_filter(), postgresIterateDirectModify(), postgresIterateForeignScan(), prepare_hash_slot(), prepare_probe_slot(), process_ordered_aggregate_multi(), recordMultipleDependencies(), RunFromStore(), setop_retrieve_direct(), setop_retrieve_hash_table(), ShutdownSetExpr(), slot_modify_data(), slot_store_data(), StoreIndexTuple(), switchToPresortedPrefixMode(), synchronize_slots(), tablesample_getnext(), tfuncLoadRows(), TidNext(), TidRangeNext(), tts_buffer_heap_copyslot(), tuplesort_gettupleslot(), tuplestore_gettupleslot(), update_frameheadpos(), update_frametailpos(), update_grouptailpos(), validate_remote_info(), ValuesNext(), and WinRowsArePeers().

◆ ExecCopySlot()

static TupleTableSlot* ExecCopySlot ( TupleTableSlot dstslot,
TupleTableSlot srcslot 
)
inlinestatic

◆ ExecCopySlotHeapTuple()

static HeapTuple ExecCopySlotHeapTuple ( TupleTableSlot slot)
inlinestatic

◆ ExecCopySlotMinimalTuple()

static MinimalTuple ExecCopySlotMinimalTuple ( TupleTableSlot slot)
inlinestatic

Definition at line 492 of file tuptable.h.

493 {
494  return slot->tts_ops->copy_minimal_tuple(slot);
495 }
MinimalTuple(* copy_minimal_tuple)(TupleTableSlot *slot)
Definition: tuptable.h:222

References TupleTableSlotOps::copy_minimal_tuple, and TupleTableSlot::tts_ops.

Referenced by cache_lookup(), cache_store_tuple(), LookupTupleHashEntry_internal(), tts_minimal_copyslot(), tuplesort_puttupleslot(), and tuplestore_puttupleslot().

◆ ExecDropSingleTupleTableSlot()

void ExecDropSingleTupleTableSlot ( TupleTableSlot slot)

Definition at line 1341 of file execTuples.c.

1342 {
1343  /* This should match ExecResetTupleTable's processing of one slot */
1344  Assert(IsA(slot, TupleTableSlot));
1345  ExecClearTuple(slot);
1346  slot->tts_ops->release(slot);
1347  if (slot->tts_tupleDescriptor)
1349  if (!TTS_FIXED(slot))
1350  {
1351  if (slot->tts_values)
1352  pfree(slot->tts_values);
1353  if (slot->tts_isnull)
1354  pfree(slot->tts_isnull);
1355  }
1356  pfree(slot);
1357 }
void pfree(void *pointer)
Definition: mcxt.c:1521
#define IsA(nodeptr, _type_)
Definition: nodes.h:158
void(* release)(TupleTableSlot *slot)
Definition: tuptable.h:143
bool * tts_isnull
Definition: tuptable.h:127
Datum * tts_values
Definition: tuptable.h:125
#define ReleaseTupleDesc(tupdesc)
Definition: tupdesc.h:122
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:454
#define TTS_FIXED(slot)
Definition: tuptable.h:108

References Assert, ExecClearTuple(), IsA, pfree(), TupleTableSlotOps::release, ReleaseTupleDesc, TTS_FIXED, TupleTableSlot::tts_isnull, TupleTableSlot::tts_ops, TupleTableSlot::tts_tupleDescriptor, and TupleTableSlot::tts_values.

Referenced by acquire_sample_rows(), AfterTriggerFreeQuery(), afterTriggerInvokeEvents(), ATRewriteTable(), CatalogIndexInsert(), check_default_partition_contents(), check_exclusion_or_unique_constraint(), check_publications(), check_publications_origin(), compute_expr_stats(), compute_index_stats(), CopyMultiInsertBufferCleanup(), copyTemplateDependencies(), DefineTSConfiguration(), deleteSplitPartitionContext(), DoCopyTo(), end_tup_output(), EnumValuesCreate(), ExecCleanupTupleRouting(), ExecEndIncrementalSort(), ExecEndModifyTable(), fetch_remote_table_info(), fetch_table_list(), freestate_cluster(), get_actual_variable_range(), get_rel_sync_entry(), heap_entry_is_visible(), heapam_index_build_range_scan(), heapam_index_validate_scan(), heapam_relation_copy_for_cluster(), hypothetical_dense_rank_final(), IndexCheckExclusion(), InsertPgAttributeTuples(), make_build_data(), MakeConfigurationMapping(), moveMergedTablesRows(), moveSplitTableRows(), pgoutput_change(), recordMultipleDependencies(), RelationFindReplTupleSeq(), RI_Initial_Check(), RunFromStore(), systable_endscan(), systable_endscan_ordered(), table_index_fetch_tuple_check(), tstoreShutdownReceiver(), validateDomainCheckConstraint(), validateDomainNotNullConstraint(), and validateForeignKeyConstraint().

◆ ExecFetchSlotHeapTuple()

HeapTuple ExecFetchSlotHeapTuple ( TupleTableSlot slot,
bool  materialize,
bool shouldFree 
)

Definition at line 1731 of file execTuples.c.

1732 {
1733  /*
1734  * sanity checks
1735  */
1736  Assert(slot != NULL);
1737  Assert(!TTS_EMPTY(slot));
1738 
1739  /* Materialize the tuple so that the slot "owns" it, if requested. */
1740  if (materialize)
1741  slot->tts_ops->materialize(slot);
1742 
1743  if (slot->tts_ops->get_heap_tuple == NULL)
1744  {
1745  if (shouldFree)
1746  *shouldFree = true;
1747  return slot->tts_ops->copy_heap_tuple(slot);
1748  }
1749  else
1750  {
1751  if (shouldFree)
1752  *shouldFree = false;
1753  return slot->tts_ops->get_heap_tuple(slot);
1754  }
1755 }
HeapTuple(* get_heap_tuple)(TupleTableSlot *slot)
Definition: tuptable.h:194
void(* materialize)(TupleTableSlot *slot)
Definition: tuptable.h:179

References Assert, TupleTableSlotOps::copy_heap_tuple, TupleTableSlotOps::get_heap_tuple, TupleTableSlotOps::materialize, TTS_EMPTY, and TupleTableSlot::tts_ops.

Referenced by AfterTriggerExecute(), apply_returning_filter(), CatalogTuplesMultiInsertWithInfo(), ExecBRDeleteTriggers(), ExecBRInsertTriggers(), ExecBRUpdateTriggers(), ExecFetchSlotHeapTupleDatum(), ExecIRInsertTriggers(), ExecIRUpdateTriggers(), heap_multi_insert(), heapam_relation_copy_for_cluster(), heapam_tuple_complete_speculative(), heapam_tuple_insert(), heapam_tuple_insert_speculative(), heapam_tuple_update(), systable_getnext(), systable_getnext_ordered(), systable_recheck_tuple(), and validateForeignKeyConstraint().

◆ ExecFetchSlotHeapTupleDatum()

Datum ExecFetchSlotHeapTupleDatum ( TupleTableSlot slot)

Definition at line 1810 of file execTuples.c.

1811 {
1812  HeapTuple tup;
1813  TupleDesc tupdesc;
1814  bool shouldFree;
1815  Datum ret;
1816 
1817  /* Fetch slot's contents in regular-physical-tuple form */
1818  tup = ExecFetchSlotHeapTuple(slot, false, &shouldFree);
1819  tupdesc = slot->tts_tupleDescriptor;
1820 
1821  /* Convert to Datum form */
1822  ret = heap_copy_tuple_as_datum(tup, tupdesc);
1823 
1824  if (shouldFree)
1825  pfree(tup);
1826 
1827  return ret;
1828 }
HeapTuple ExecFetchSlotHeapTuple(TupleTableSlot *slot, bool materialize, bool *shouldFree)
Definition: execTuples.c:1731
Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc)
Definition: heaptuple.c:1080
uintptr_t Datum
Definition: postgres.h:64

References ExecFetchSlotHeapTuple(), heap_copy_tuple_as_datum(), pfree(), and TupleTableSlot::tts_tupleDescriptor.

Referenced by ExecMakeFunctionResultSet(), and postquel_get_single_result().

◆ ExecFetchSlotMinimalTuple()

MinimalTuple ExecFetchSlotMinimalTuple ( TupleTableSlot slot,
bool shouldFree 
)

Definition at line 1779 of file execTuples.c.

1781 {
1782  /*
1783  * sanity checks
1784  */
1785  Assert(slot != NULL);
1786  Assert(!TTS_EMPTY(slot));
1787 
1788  if (slot->tts_ops->get_minimal_tuple)
1789  {
1790  if (shouldFree)
1791  *shouldFree = false;
1792  return slot->tts_ops->get_minimal_tuple(slot);
1793  }
1794  else
1795  {
1796  if (shouldFree)
1797  *shouldFree = true;
1798  return slot->tts_ops->copy_minimal_tuple(slot);
1799  }
1800 }
MinimalTuple(* get_minimal_tuple)(TupleTableSlot *slot)
Definition: tuptable.h:202

References Assert, TupleTableSlotOps::copy_minimal_tuple, TupleTableSlotOps::get_minimal_tuple, TTS_EMPTY, and TupleTableSlot::tts_ops.

Referenced by ExecHashJoinImpl(), ExecHashSkewTableInsert(), ExecHashTableInsert(), ExecParallelHashJoinPartitionOuter(), ExecParallelHashTableInsert(), ExecParallelHashTableInsertCurrentBatch(), hashagg_spill_tuple(), and tqueueReceiveSlot().

◆ ExecForceStoreHeapTuple()

void ExecForceStoreHeapTuple ( HeapTuple  tuple,
TupleTableSlot slot,
bool  shouldFree 
)

Definition at line 1556 of file execTuples.c.

1559 {
1560  if (TTS_IS_HEAPTUPLE(slot))
1561  {
1562  ExecStoreHeapTuple(tuple, slot, shouldFree);
1563  }
1564  else if (TTS_IS_BUFFERTUPLE(slot))
1565  {
1566  MemoryContext oldContext;
1568 
1569  ExecClearTuple(slot);
1570  slot->tts_flags &= ~TTS_FLAG_EMPTY;
1571  oldContext = MemoryContextSwitchTo(slot->tts_mcxt);
1572  bslot->base.tuple = heap_copytuple(tuple);
1573  slot->tts_flags |= TTS_FLAG_SHOULDFREE;
1574  MemoryContextSwitchTo(oldContext);
1575 
1576  if (shouldFree)
1577  pfree(tuple);
1578  }
1579  else
1580  {
1581  ExecClearTuple(slot);
1583  slot->tts_values, slot->tts_isnull);
1584  ExecStoreVirtualTuple(slot);
1585 
1586  if (shouldFree)
1587  {
1588  ExecMaterializeSlot(slot);
1589  pfree(tuple);
1590  }
1591  }
1592 }
TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)
Definition: execTuples.c:1639
TupleTableSlot * ExecStoreHeapTuple(HeapTuple tuple, TupleTableSlot *slot, bool shouldFree)
Definition: execTuples.c:1439
HeapTuple heap_copytuple(HeapTuple tuple)
Definition: heaptuple.c:776
void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)
Definition: heaptuple.c:1345
MemoryContextSwitchTo(old_ctx)
MemoryContext tts_mcxt
Definition: tuptable.h:128
uint16 tts_flags
Definition: tuptable.h:118
#define TTS_FLAG_EMPTY
Definition: tuptable.h:95
#define TTS_FLAG_SHOULDFREE
Definition: tuptable.h:99
#define TTS_IS_BUFFERTUPLE(slot)
Definition: tuptable.h:237
static void ExecMaterializeSlot(TupleTableSlot *slot)
Definition: tuptable.h:472
#define TTS_IS_HEAPTUPLE(slot)
Definition: tuptable.h:235

References ExecClearTuple(), ExecMaterializeSlot(), ExecStoreHeapTuple(), ExecStoreVirtualTuple(), heap_copytuple(), heap_deform_tuple(), MemoryContextSwitchTo(), pfree(), TTS_FLAG_EMPTY, TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, TTS_IS_BUFFERTUPLE, TTS_IS_HEAPTUPLE, TupleTableSlot::tts_isnull, TupleTableSlot::tts_mcxt, TupleTableSlot::tts_tupleDescriptor, and TupleTableSlot::tts_values.

Referenced by agg_retrieve_direct(), ExecARDeleteTriggers(), ExecARUpdateTriggers(), ExecBRDeleteTriggers(), ExecBRInsertTriggers(), ExecBRUpdateTriggers(), ExecDelete(), ExecIRDeleteTriggers(), ExecIRInsertTriggers(), ExecIRUpdateTriggers(), ExecMergeMatched(), ExecModifyTable(), IndexNextWithReorder(), IndexOnlyNext(), and store_returning_result().

◆ ExecForceStoreMinimalTuple()

void ExecForceStoreMinimalTuple ( MinimalTuple  mtup,
TupleTableSlot slot,
bool  shouldFree 
)

Definition at line 1599 of file execTuples.c.

1602 {
1603  if (TTS_IS_MINIMALTUPLE(slot))
1604  {
1605  tts_minimal_store_tuple(slot, mtup, shouldFree);
1606  }
1607  else
1608  {
1609  HeapTupleData htup;
1610 
1611  ExecClearTuple(slot);
1612 
1613  htup.t_len = mtup->t_len + MINIMAL_TUPLE_OFFSET;
1614  htup.t_data = (HeapTupleHeader) ((char *) mtup - MINIMAL_TUPLE_OFFSET);
1616  slot->tts_values, slot->tts_isnull);
1617  ExecStoreVirtualTuple(slot);
1618 
1619  if (shouldFree)
1620  {
1621  ExecMaterializeSlot(slot);
1622  pfree(mtup);
1623  }
1624  }
1625 }
static void tts_minimal_store_tuple(TupleTableSlot *slot, MinimalTuple mtup, bool shouldFree)
Definition: execTuples.c:680
HeapTupleHeaderData * HeapTupleHeader
Definition: htup.h:23
#define MINIMAL_TUPLE_OFFSET
Definition: htup_details.h:617
uint32 t_len
Definition: htup.h:64
HeapTupleHeader t_data
Definition: htup.h:68
#define TTS_IS_MINIMALTUPLE(slot)
Definition: tuptable.h:236

References ExecClearTuple(), ExecMaterializeSlot(), ExecStoreVirtualTuple(), heap_deform_tuple(), MINIMAL_TUPLE_OFFSET, pfree(), HeapTupleData::t_data, HeapTupleData::t_len, MinimalTupleData::t_len, TTS_IS_MINIMALTUPLE, TupleTableSlot::tts_isnull, tts_minimal_store_tuple(), TupleTableSlot::tts_tupleDescriptor, and TupleTableSlot::tts_values.

Referenced by ExecHashJoinGetSavedTuple(), ExecParallelHashJoinNewBatch(), and ExecParallelHashJoinOuterGetTuple().

◆ ExecMaterializeSlot()

◆ ExecResetTupleTable()

void ExecResetTupleTable ( List tupleTable,
bool  shouldFree 
)

Definition at line 1278 of file execTuples.c.

1280 {
1281  ListCell *lc;
1282 
1283  foreach(lc, tupleTable)
1284  {
1286 
1287  /* Always release resources and reset the slot to empty */
1288  ExecClearTuple(slot);
1289  slot->tts_ops->release(slot);
1290  if (slot->tts_tupleDescriptor)
1291  {
1293  slot->tts_tupleDescriptor = NULL;
1294  }
1295 
1296  /* If shouldFree, release memory occupied by the slot itself */
1297  if (shouldFree)
1298  {
1299  if (!TTS_FIXED(slot))
1300  {
1301  if (slot->tts_values)
1302  pfree(slot->tts_values);
1303  if (slot->tts_isnull)
1304  pfree(slot->tts_isnull);
1305  }
1306  pfree(slot);
1307  }
1308  }
1309 
1310  /* If shouldFree, release the list structure */
1311  if (shouldFree)
1312  list_free(tupleTable);
1313 }
void list_free(List *list)
Definition: list.c:1546
#define lfirst_node(type, lc)
Definition: pg_list.h:176

References ExecClearTuple(), lfirst_node, list_free(), pfree(), TupleTableSlotOps::release, ReleaseTupleDesc, TTS_FIXED, TupleTableSlot::tts_isnull, TupleTableSlot::tts_ops, TupleTableSlot::tts_tupleDescriptor, and TupleTableSlot::tts_values.

Referenced by afterTriggerInvokeEvents(), CopyFrom(), EvalPlanQualEnd(), ExecEndPlan(), and finish_edata().

◆ ExecSetSlotDescriptor()

void ExecSetSlotDescriptor ( TupleTableSlot slot,
TupleDesc  tupdesc 
)

Definition at line 1376 of file execTuples.c.

1378 {
1379  Assert(!TTS_FIXED(slot));
1380 
1381  /* For safety, make sure slot is empty before changing it */
1382  ExecClearTuple(slot);
1383 
1384  /*
1385  * Release any old descriptor. Also release old Datum/isnull arrays if
1386  * present (we don't bother to check if they could be re-used).
1387  */
1388  if (slot->tts_tupleDescriptor)
1390 
1391  if (slot->tts_values)
1392  pfree(slot->tts_values);
1393  if (slot->tts_isnull)
1394  pfree(slot->tts_isnull);
1395 
1396  /*
1397  * Install the new descriptor; if it's refcounted, bump its refcount.
1398  */
1399  slot->tts_tupleDescriptor = tupdesc;
1400  PinTupleDesc(tupdesc);
1401 
1402  /*
1403  * Allocate Datum/isnull arrays of the appropriate size. These must have
1404  * the same lifetime as the slot, so allocate in the slot's own context.
1405  */
1406  slot->tts_values = (Datum *)
1407  MemoryContextAlloc(slot->tts_mcxt, tupdesc->natts * sizeof(Datum));
1408  slot->tts_isnull = (bool *)
1409  MemoryContextAlloc(slot->tts_mcxt, tupdesc->natts * sizeof(bool));
1410 }
void * MemoryContextAlloc(MemoryContext context, Size size)
Definition: mcxt.c:1181
#define PinTupleDesc(tupdesc)
Definition: tupdesc.h:116

References Assert, ExecClearTuple(), MemoryContextAlloc(), TupleDescData::natts, pfree(), PinTupleDesc, ReleaseTupleDesc, TTS_FIXED, TupleTableSlot::tts_isnull, TupleTableSlot::tts_mcxt, TupleTableSlot::tts_tupleDescriptor, and TupleTableSlot::tts_values.

Referenced by ExecAssignScanType(), ExecInitJunkFilter(), and ExecInitJunkFilterConversion().

◆ ExecStoreAllNullTuple()

TupleTableSlot* ExecStoreAllNullTuple ( TupleTableSlot slot)

Definition at line 1663 of file execTuples.c.

1664 {
1665  /*
1666  * sanity checks
1667  */
1668  Assert(slot != NULL);
1669  Assert(slot->tts_tupleDescriptor != NULL);
1670 
1671  /* Clear any old contents */
1672  ExecClearTuple(slot);
1673 
1674  /*
1675  * Fill all the columns of the virtual tuple with nulls
1676  */
1677  MemSet(slot->tts_values, 0,
1678  slot->tts_tupleDescriptor->natts * sizeof(Datum));
1679  memset(slot->tts_isnull, true,
1680  slot->tts_tupleDescriptor->natts * sizeof(bool));
1681 
1682  return ExecStoreVirtualTuple(slot);
1683 }
#define MemSet(start, val, len)
Definition: c.h:1020

References Assert, ExecClearTuple(), ExecStoreVirtualTuple(), MemSet, TupleDescData::natts, TupleTableSlot::tts_isnull, TupleTableSlot::tts_tupleDescriptor, and TupleTableSlot::tts_values.

Referenced by ATRewriteTable(), createSplitPartitionContext(), ExecDelete(), ExecInitNullTupleSlot(), get_returning_data(), heapam_scan_bitmap_next_tuple(), moveMergedTablesRows(), and prepare_projection_slot().

◆ ExecStoreBufferHeapTuple()

TupleTableSlot* ExecStoreBufferHeapTuple ( HeapTuple  tuple,
TupleTableSlot slot,
Buffer  buffer 
)

Definition at line 1479 of file execTuples.c.

1482 {
1483  /*
1484  * sanity checks
1485  */
1486  Assert(tuple != NULL);
1487  Assert(slot != NULL);
1488  Assert(slot->tts_tupleDescriptor != NULL);
1489  Assert(BufferIsValid(buffer));
1490 
1491  if (unlikely(!TTS_IS_BUFFERTUPLE(slot)))
1492  elog(ERROR, "trying to store an on-disk heap tuple into wrong type of slot");
1493  tts_buffer_heap_store_tuple(slot, tuple, buffer, false);
1494 
1495  slot->tts_tableOid = tuple->t_tableOid;
1496 
1497  return slot;
1498 }
static bool BufferIsValid(Buffer bufnum)
Definition: bufmgr.h:355
#define unlikely(x)
Definition: c.h:311
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:224
static void tts_buffer_heap_store_tuple(TupleTableSlot *slot, HeapTuple tuple, Buffer buffer, bool transfer_pin)
Definition: execTuples.c:942
Oid t_tableOid
Definition: htup.h:66
Oid tts_tableOid
Definition: tuptable.h:130

References Assert, BufferIsValid(), elog, ERROR, HeapTupleData::t_tableOid, tts_buffer_heap_store_tuple(), TTS_IS_BUFFERTUPLE, TupleTableSlot::tts_tableOid, TupleTableSlot::tts_tupleDescriptor, and unlikely.

Referenced by heap_getnextslot(), heap_getnextslot_tidrange(), heapam_index_build_range_scan(), heapam_index_fetch_tuple(), heapam_scan_analyze_next_tuple(), heapam_scan_bitmap_next_tuple(), and heapam_scan_sample_next_tuple().

◆ ExecStoreHeapTuple()

TupleTableSlot* ExecStoreHeapTuple ( HeapTuple  tuple,
TupleTableSlot slot,
bool  shouldFree 
)

Definition at line 1439 of file execTuples.c.

1442 {
1443  /*
1444  * sanity checks
1445  */
1446  Assert(tuple != NULL);
1447  Assert(slot != NULL);
1448  Assert(slot->tts_tupleDescriptor != NULL);
1449 
1450  if (unlikely(!TTS_IS_HEAPTUPLE(slot)))
1451  elog(ERROR, "trying to store a heap tuple into wrong type of slot");
1452  tts_heap_store_tuple(slot, tuple, shouldFree);
1453 
1454  slot->tts_tableOid = tuple->t_tableOid;
1455 
1456  return slot;
1457 }
static void tts_heap_store_tuple(TupleTableSlot *slot, HeapTuple tuple, bool shouldFree)
Definition: execTuples.c:486

References Assert, elog, ERROR, HeapTupleData::t_tableOid, tts_heap_store_tuple(), TTS_IS_HEAPTUPLE, TupleTableSlot::tts_tableOid, TupleTableSlot::tts_tupleDescriptor, and unlikely.

Referenced by CatalogIndexInsert(), comparetup_cluster_tiebreak(), compute_expr_stats(), compute_index_stats(), ExecForceStoreHeapTuple(), ExecuteCallStmt(), get_returning_data(), heapam_index_validate_scan(), make_build_data(), pgoutput_change(), postgresIterateForeignScan(), setop_retrieve_direct(), and tts_heap_copyslot().

◆ ExecStoreHeapTupleDatum()

void ExecStoreHeapTupleDatum ( Datum  data,
TupleTableSlot slot 
)

Definition at line 1693 of file execTuples.c.

1694 {
1695  HeapTupleData tuple = {0};
1696  HeapTupleHeader td;
1697 
1699 
1701  tuple.t_self = td->t_ctid;
1702  tuple.t_data = td;
1703 
1704  ExecClearTuple(slot);
1705 
1706  heap_deform_tuple(&tuple, slot->tts_tupleDescriptor,
1707  slot->tts_values, slot->tts_isnull);
1708  ExecStoreVirtualTuple(slot);
1709 }
#define DatumGetHeapTupleHeader(X)
Definition: fmgr.h:295
#define HeapTupleHeaderGetDatumLength(tup)
Definition: htup_details.h:450
const void * data
ItemPointerData t_self
Definition: htup.h:65
ItemPointerData t_ctid
Definition: htup_details.h:161

References data, DatumGetHeapTupleHeader, ExecClearTuple(), ExecStoreVirtualTuple(), heap_deform_tuple(), HeapTupleHeaderGetDatumLength, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, TupleTableSlot::tts_isnull, TupleTableSlot::tts_tupleDescriptor, and TupleTableSlot::tts_values.

Referenced by EvalPlanQualFetchRowMark().

◆ ExecStoreMinimalTuple()

TupleTableSlot* ExecStoreMinimalTuple ( MinimalTuple  mtup,
TupleTableSlot slot,
bool  shouldFree 
)

◆ ExecStorePinnedBufferHeapTuple()

TupleTableSlot* ExecStorePinnedBufferHeapTuple ( HeapTuple  tuple,
TupleTableSlot slot,
Buffer  buffer 
)

Definition at line 1505 of file execTuples.c.

1508 {
1509  /*
1510  * sanity checks
1511  */
1512  Assert(tuple != NULL);
1513  Assert(slot != NULL);
1514  Assert(slot->tts_tupleDescriptor != NULL);
1515  Assert(BufferIsValid(buffer));
1516 
1517  if (unlikely(!TTS_IS_BUFFERTUPLE(slot)))
1518  elog(ERROR, "trying to store an on-disk heap tuple into wrong type of slot");
1519  tts_buffer_heap_store_tuple(slot, tuple, buffer, true);
1520 
1521  slot->tts_tableOid = tuple->t_tableOid;
1522 
1523  return slot;
1524 }

References Assert, BufferIsValid(), elog, ERROR, HeapTupleData::t_tableOid, tts_buffer_heap_store_tuple(), TTS_IS_BUFFERTUPLE, TupleTableSlot::tts_tableOid, TupleTableSlot::tts_tupleDescriptor, and unlikely.

Referenced by heapam_fetch_row_version(), and heapam_tuple_lock().

◆ ExecStoreVirtualTuple()

TupleTableSlot* ExecStoreVirtualTuple ( TupleTableSlot slot)

Definition at line 1639 of file execTuples.c.

1640 {
1641  /*
1642  * sanity checks
1643  */
1644  Assert(slot != NULL);
1645  Assert(slot->tts_tupleDescriptor != NULL);
1646  Assert(TTS_EMPTY(slot));
1647 
1648  slot->tts_flags &= ~TTS_FLAG_EMPTY;
1649  slot->tts_nvalid = slot->tts_tupleDescriptor->natts;
1650 
1651  return slot;
1652 }
AttrNumber tts_nvalid
Definition: tuptable.h:120

References Assert, TupleDescData::natts, TTS_EMPTY, TTS_FLAG_EMPTY, TupleTableSlot::tts_flags, TupleTableSlot::tts_nvalid, and TupleTableSlot::tts_tupleDescriptor.

Referenced by agg_retrieve_hash_table_in_memory(), apply_returning_filter(), ATRewriteTable(), CopyFrom(), copyTemplateDependencies(), DefineTSConfiguration(), do_tup_output(), EnumValuesCreate(), ExecComputeStoredGenerated(), ExecEvalAggOrderedTransTuple(), ExecEvalPreOrderedDistinctMulti(), ExecFilterJunk(), ExecForceStoreHeapTuple(), ExecForceStoreMinimalTuple(), ExecProjectSRF(), ExecSort(), ExecStoreAllNullTuple(), ExecStoreHeapTupleDatum(), execute_attr_map_slot(), fileIterateForeignScan(), FunctionNext(), hashagg_spill_tuple(), hypothetical_dense_rank_final(), hypothetical_rank_common(), InsertPgAttributeTuples(), MakeConfigurationMapping(), moveMergedTablesRows(), moveSplitTableRows(), ordered_set_transition_multi(), pgoutput_row_filter(), prepare_hash_slot(), prepare_probe_slot(), recordMultipleDependencies(), RI_Initial_Check(), RI_PartitionRemove_Check(), slot_modify_data(), slot_store_data(), StoreIndexTuple(), and ValuesNext().

◆ MakeSingleTupleTableSlot()

◆ MakeTupleTableSlot()

TupleTableSlot* MakeTupleTableSlot ( TupleDesc  tupleDesc,
const TupleTableSlotOps tts_ops 
)

Definition at line 1199 of file execTuples.c.

1201 {
1202  Size basesz,
1203  allocsz;
1204  TupleTableSlot *slot;
1205 
1206  basesz = tts_ops->base_slot_size;
1207 
1208  /*
1209  * When a fixed descriptor is specified, we can reduce overhead by
1210  * allocating the entire slot in one go.
1211  */
1212  if (tupleDesc)
1213  allocsz = MAXALIGN(basesz) +
1214  MAXALIGN(tupleDesc->natts * sizeof(Datum)) +
1215  MAXALIGN(tupleDesc->natts * sizeof(bool));
1216  else
1217  allocsz = basesz;
1218 
1219  slot = palloc0(allocsz);
1220  /* const for optimization purposes, OK to modify at allocation time */
1221  *((const TupleTableSlotOps **) &slot->tts_ops) = tts_ops;
1222  slot->type = T_TupleTableSlot;
1223  slot->tts_flags |= TTS_FLAG_EMPTY;
1224  if (tupleDesc != NULL)
1225  slot->tts_flags |= TTS_FLAG_FIXED;
1226  slot->tts_tupleDescriptor = tupleDesc;
1228  slot->tts_nvalid = 0;
1229 
1230  if (tupleDesc != NULL)
1231  {
1232  slot->tts_values = (Datum *)
1233  (((char *) slot)
1234  + MAXALIGN(basesz));
1235  slot->tts_isnull = (bool *)
1236  (((char *) slot)
1237  + MAXALIGN(basesz)
1238  + MAXALIGN(tupleDesc->natts * sizeof(Datum)));
1239 
1240  PinTupleDesc(tupleDesc);
1241  }
1242 
1243  /*
1244  * And allow slot type specific initialization.
1245  */
1246  slot->tts_ops->init(slot);
1247 
1248  return slot;
1249 }
#define MAXALIGN(LEN)
Definition: c.h:811
size_t Size
Definition: c.h:605
void * palloc0(Size size)
Definition: mcxt.c:1347
MemoryContext CurrentMemoryContext
Definition: mcxt.c:143
size_t base_slot_size
Definition: tuptable.h:137
void(* init)(TupleTableSlot *slot)
Definition: tuptable.h:140
NodeTag type
Definition: tuptable.h:116
#define TTS_FLAG_FIXED
Definition: tuptable.h:107

References TupleTableSlotOps::base_slot_size, CurrentMemoryContext, TupleTableSlotOps::init, MAXALIGN, TupleDescData::natts, palloc0(), PinTupleDesc, TTS_FLAG_EMPTY, TTS_FLAG_FIXED, TupleTableSlot::tts_flags, TupleTableSlot::tts_isnull, TupleTableSlot::tts_mcxt, TupleTableSlot::tts_nvalid, TupleTableSlot::tts_ops, TupleTableSlot::tts_tupleDescriptor, TupleTableSlot::tts_values, and TupleTableSlot::type.

Referenced by ExecAllocTableSlot(), ExecConstraints(), ExecPartitionCheckEmitError(), ExecWithCheckOptions(), MakeSingleTupleTableSlot(), and pgoutput_change().

◆ slot_attisnull()

static bool slot_attisnull ( TupleTableSlot slot,
int  attnum 
)
inlinestatic

Definition at line 381 of file tuptable.h.

382 {
383  Assert(attnum > 0);
384 
385  if (attnum > slot->tts_nvalid)
386  slot_getsomeattrs(slot, attnum);
387 
388  return slot->tts_isnull[attnum - 1];
389 }
int16 attnum
Definition: pg_attribute.h:74
static void slot_getsomeattrs(TupleTableSlot *slot, int attnum)
Definition: tuptable.h:355

References Assert, attnum, slot_getsomeattrs(), TupleTableSlot::tts_isnull, and TupleTableSlot::tts_nvalid.

Referenced by ATRewriteTable(), ExecConstraints(), ri_NullCheck(), slotAllNulls(), slotNoNulls(), and validateDomainNotNullConstraint().

◆ slot_getallattrs()

◆ slot_getattr()

◆ slot_getmissingattrs()

void slot_getmissingattrs ( TupleTableSlot slot,
int  startAttNum,
int  lastAttNum 
)

Definition at line 1955 of file execTuples.c.

1956 {
1957  AttrMissing *attrmiss = NULL;
1958 
1959  if (slot->tts_tupleDescriptor->constr)
1960  attrmiss = slot->tts_tupleDescriptor->constr->missing;
1961 
1962  if (!attrmiss)
1963  {
1964  /* no missing values array at all, so just fill everything in as NULL */
1965  memset(slot->tts_values + startAttNum, 0,
1966  (lastAttNum - startAttNum) * sizeof(Datum));
1967  memset(slot->tts_isnull + startAttNum, 1,
1968  (lastAttNum - startAttNum) * sizeof(bool));
1969  }
1970  else
1971  {
1972  int missattnum;
1973 
1974  /* if there is a missing values array we must process them one by one */
1975  for (missattnum = startAttNum;
1976  missattnum < lastAttNum;
1977  missattnum++)
1978  {
1979  slot->tts_values[missattnum] = attrmiss[missattnum].am_value;
1980  slot->tts_isnull[missattnum] = !attrmiss[missattnum].am_present;
1981  }
1982  }
1983 }
struct AttrMissing * missing
Definition: tupdesc.h:41
TupleConstr * constr
Definition: tupdesc.h:85

References AttrMissing::am_present, AttrMissing::am_value, TupleDescData::constr, TupleConstr::missing, TupleTableSlot::tts_isnull, TupleTableSlot::tts_tupleDescriptor, and TupleTableSlot::tts_values.

Referenced by slot_getsomeattrs_int().

◆ slot_getsomeattrs()

static void slot_getsomeattrs ( TupleTableSlot slot,
int  attnum 
)
inlinestatic

◆ slot_getsomeattrs_int()

void slot_getsomeattrs_int ( TupleTableSlot slot,
int  attnum 
)

Definition at line 1989 of file execTuples.c.

1990 {
1991  /* Check for caller errors */
1992  Assert(slot->tts_nvalid < attnum); /* checked in slot_getsomeattrs */
1993  Assert(attnum > 0);
1994 
1995  if (unlikely(attnum > slot->tts_tupleDescriptor->natts))
1996  elog(ERROR, "invalid attribute number %d", attnum);
1997 
1998  /* Fetch as many attributes as possible from the underlying tuple. */
1999  slot->tts_ops->getsomeattrs(slot, attnum);
2000 
2001  /*
2002  * If the underlying tuple doesn't have enough attributes, tuple
2003  * descriptor must have the missing attributes.
2004  */
2005  if (unlikely(slot->tts_nvalid < attnum))
2006  {
2007  slot_getmissingattrs(slot, slot->tts_nvalid, attnum);
2008  slot->tts_nvalid = attnum;
2009  }
2010 }
void slot_getmissingattrs(TupleTableSlot *slot, int startAttNum, int lastAttNum)
Definition: execTuples.c:1955
void(* getsomeattrs)(TupleTableSlot *slot, int natts)
Definition: tuptable.h:160

References Assert, attnum, elog, ERROR, TupleTableSlotOps::getsomeattrs, TupleDescData::natts, slot_getmissingattrs(), TupleTableSlot::tts_nvalid, TupleTableSlot::tts_ops, TupleTableSlot::tts_tupleDescriptor, and unlikely.

Referenced by slot_getsomeattrs().

◆ slot_getsysattr()

static Datum slot_getsysattr ( TupleTableSlot slot,
int  attnum,
bool isnull 
)
inlinestatic

Definition at line 416 of file tuptable.h.

417 {
418  Assert(attnum < 0); /* caller error */
419 
421  {
422  *isnull = false;
423  return ObjectIdGetDatum(slot->tts_tableOid);
424  }
426  {
427  *isnull = false;
428  return PointerGetDatum(&slot->tts_tid);
429  }
430 
431  /* Fetch the system attribute from the underlying tuple. */
432  return slot->tts_ops->getsysattr(slot, attnum, isnull);
433 }
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:322
static Datum ObjectIdGetDatum(Oid X)
Definition: postgres.h:252
Datum(* getsysattr)(TupleTableSlot *slot, int attnum, bool *isnull)
Definition: tuptable.h:167
ItemPointerData tts_tid
Definition: tuptable.h:129
#define TableOidAttributeNumber
Definition: sysattr.h:26
#define SelfItemPointerAttributeNumber
Definition: sysattr.h:21

References Assert, attnum, TupleTableSlotOps::getsysattr, ObjectIdGetDatum(), PointerGetDatum(), SelfItemPointerAttributeNumber, TableOidAttributeNumber, TupleTableSlot::tts_ops, TupleTableSlot::tts_tableOid, and TupleTableSlot::tts_tid.

Referenced by ExecCheckTupleVisible(), execCurrentOf(), ExecEvalSysVar(), ExecOnConflictUpdate(), and FormIndexDatum().

◆ slot_is_current_xact_tuple()

static bool slot_is_current_xact_tuple ( TupleTableSlot slot)
inlinestatic

Definition at line 445 of file tuptable.h.

446 {
447  return slot->tts_ops->is_current_xact_tuple(slot);
448 }
bool(* is_current_xact_tuple)(TupleTableSlot *slot)
Definition: tuptable.h:173

References TupleTableSlotOps::is_current_xact_tuple, and TupleTableSlot::tts_ops.

Referenced by RI_FKey_fk_upd_check_required().

Variable Documentation

◆ TTSOpsBufferHeapTuple

PGDLLIMPORT const TupleTableSlotOps TTSOpsBufferHeapTuple
extern

◆ TTSOpsHeapTuple

◆ TTSOpsMinimalTuple

◆ TTSOpsVirtual