PostgreSQL Source Code  git master
execTuples.c File Reference
#include "postgres.h"
#include "access/heaptoast.h"
#include "access/htup_details.h"
#include "access/tupdesc_details.h"
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "nodes/nodeFuncs.h"
#include "storage/bufmgr.h"
#include "utils/builtins.h"
#include "utils/expandeddatum.h"
#include "utils/lsyscache.h"
#include "utils/typcache.h"
Include dependency graph for execTuples.c:

Go to the source code of this file.

Functions

static TupleDesc ExecTypeFromTLInternal (List *targetList, bool skipjunk)
 
static pg_attribute_always_inline void slot_deform_heap_tuple (TupleTableSlot *slot, HeapTuple tuple, uint32 *offp, int natts)
 
static void tts_buffer_heap_store_tuple (TupleTableSlot *slot, HeapTuple tuple, Buffer buffer, bool transfer_pin)
 
static void tts_heap_store_tuple (TupleTableSlot *slot, HeapTuple tuple, bool shouldFree)
 
static void tts_virtual_init (TupleTableSlot *slot)
 
static void tts_virtual_release (TupleTableSlot *slot)
 
static void tts_virtual_clear (TupleTableSlot *slot)
 
static void tts_virtual_getsomeattrs (TupleTableSlot *slot, int natts)
 
static Datum tts_virtual_getsysattr (TupleTableSlot *slot, int attnum, bool *isnull)
 
static bool tts_virtual_is_current_xact_tuple (TupleTableSlot *slot)
 
static void tts_virtual_materialize (TupleTableSlot *slot)
 
static void tts_virtual_copyslot (TupleTableSlot *dstslot, TupleTableSlot *srcslot)
 
static HeapTuple tts_virtual_copy_heap_tuple (TupleTableSlot *slot)
 
static MinimalTuple tts_virtual_copy_minimal_tuple (TupleTableSlot *slot)
 
static void tts_heap_init (TupleTableSlot *slot)
 
static void tts_heap_release (TupleTableSlot *slot)
 
static void tts_heap_clear (TupleTableSlot *slot)
 
static void tts_heap_getsomeattrs (TupleTableSlot *slot, int natts)
 
static Datum tts_heap_getsysattr (TupleTableSlot *slot, int attnum, bool *isnull)
 
static bool tts_heap_is_current_xact_tuple (TupleTableSlot *slot)
 
static void tts_heap_materialize (TupleTableSlot *slot)
 
static void tts_heap_copyslot (TupleTableSlot *dstslot, TupleTableSlot *srcslot)
 
static HeapTuple tts_heap_get_heap_tuple (TupleTableSlot *slot)
 
static HeapTuple tts_heap_copy_heap_tuple (TupleTableSlot *slot)
 
static MinimalTuple tts_heap_copy_minimal_tuple (TupleTableSlot *slot)
 
static void tts_minimal_init (TupleTableSlot *slot)
 
static void tts_minimal_release (TupleTableSlot *slot)
 
static void tts_minimal_clear (TupleTableSlot *slot)
 
static void tts_minimal_getsomeattrs (TupleTableSlot *slot, int natts)
 
static Datum tts_minimal_getsysattr (TupleTableSlot *slot, int attnum, bool *isnull)
 
static bool tts_minimal_is_current_xact_tuple (TupleTableSlot *slot)
 
static void tts_minimal_materialize (TupleTableSlot *slot)
 
static void tts_minimal_copyslot (TupleTableSlot *dstslot, TupleTableSlot *srcslot)
 
static MinimalTuple tts_minimal_get_minimal_tuple (TupleTableSlot *slot)
 
static HeapTuple tts_minimal_copy_heap_tuple (TupleTableSlot *slot)
 
static MinimalTuple tts_minimal_copy_minimal_tuple (TupleTableSlot *slot)
 
static void tts_minimal_store_tuple (TupleTableSlot *slot, MinimalTuple mtup, bool shouldFree)
 
static void tts_buffer_heap_init (TupleTableSlot *slot)
 
static void tts_buffer_heap_release (TupleTableSlot *slot)
 
static void tts_buffer_heap_clear (TupleTableSlot *slot)
 
static void tts_buffer_heap_getsomeattrs (TupleTableSlot *slot, int natts)
 
static Datum tts_buffer_heap_getsysattr (TupleTableSlot *slot, int attnum, bool *isnull)
 
static bool tts_buffer_is_current_xact_tuple (TupleTableSlot *slot)
 
static void tts_buffer_heap_materialize (TupleTableSlot *slot)
 
static void tts_buffer_heap_copyslot (TupleTableSlot *dstslot, TupleTableSlot *srcslot)
 
static HeapTuple tts_buffer_heap_get_heap_tuple (TupleTableSlot *slot)
 
static HeapTuple tts_buffer_heap_copy_heap_tuple (TupleTableSlot *slot)
 
static MinimalTuple tts_buffer_heap_copy_minimal_tuple (TupleTableSlot *slot)
 
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)
 
TupleTableSlotExecStoreBufferHeapTuple (HeapTuple tuple, TupleTableSlot *slot, Buffer buffer)
 
TupleTableSlotExecStorePinnedBufferHeapTuple (HeapTuple tuple, TupleTableSlot *slot, Buffer buffer)
 
TupleTableSlotExecStoreMinimalTuple (MinimalTuple mtup, TupleTableSlot *slot, bool shouldFree)
 
void ExecForceStoreHeapTuple (HeapTuple tuple, 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 ExecInitResultTypeTL (PlanState *planstate)
 
void ExecInitResultSlot (PlanState *planstate, const TupleTableSlotOps *tts_ops)
 
void ExecInitResultTupleSlotTL (PlanState *planstate, const TupleTableSlotOps *tts_ops)
 
void ExecInitScanTupleSlot (EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
 
TupleTableSlotExecInitExtraTupleSlot (EState *estate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
 
TupleTableSlotExecInitNullTupleSlot (EState *estate, TupleDesc tupType, const TupleTableSlotOps *tts_ops)
 
void slot_getmissingattrs (TupleTableSlot *slot, int startAttNum, int lastAttNum)
 
void slot_getsomeattrs_int (TupleTableSlot *slot, int attnum)
 
TupleDesc ExecTypeFromTL (List *targetList)
 
TupleDesc ExecCleanTypeFromTL (List *targetList)
 
TupleDesc ExecTypeFromExprList (List *exprList)
 
void ExecTypeSetColNames (TupleDesc typeInfo, List *namesList)
 
TupleDesc BlessTupleDesc (TupleDesc tupdesc)
 
AttInMetadataTupleDescGetAttInMetadata (TupleDesc tupdesc)
 
HeapTuple BuildTupleFromCStrings (AttInMetadata *attinmeta, char **values)
 
Datum HeapTupleHeaderGetDatum (HeapTupleHeader tuple)
 
TupOutputStatebegin_tup_output_tupdesc (DestReceiver *dest, TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
 
void do_tup_output (TupOutputState *tstate, const Datum *values, const bool *isnull)
 
void do_text_output_multiline (TupOutputState *tstate, const char *txt)
 
void end_tup_output (TupOutputState *tstate)
 

Variables

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

Function Documentation

◆ begin_tup_output_tupdesc()

TupOutputState* begin_tup_output_tupdesc ( DestReceiver dest,
TupleDesc  tupdesc,
const TupleTableSlotOps tts_ops 
)

Definition at line 2342 of file execTuples.c.

2345 {
2346  TupOutputState *tstate;
2347 
2348  tstate = (TupOutputState *) palloc(sizeof(TupOutputState));
2349 
2350  tstate->slot = MakeSingleTupleTableSlot(tupdesc, tts_ops);
2351  tstate->dest = dest;
2352 
2353  tstate->dest->rStartup(tstate->dest, (int) CMD_SELECT, tupdesc);
2354 
2355  return tstate;
2356 }
TupleTableSlot * MakeSingleTupleTableSlot(TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1325
void * palloc(Size size)
Definition: mcxt.c:1316
@ CMD_SELECT
Definition: nodes.h:265
TupleTableSlot * slot
Definition: executor.h:506
DestReceiver * dest
Definition: executor.h:507
void(* rStartup)(DestReceiver *self, int operation, TupleDesc typeinfo)
Definition: dest.h:121

References CMD_SELECT, generate_unaccent_rules::dest, TupOutputState::dest, MakeSingleTupleTableSlot(), palloc(), _DestReceiver::rStartup, and TupOutputState::slot.

Referenced by CreateReplicationSlot(), ExecuteCallStmt(), ExplainQuery(), IdentifySystem(), ReadReplicationSlot(), SendTablespaceList(), SendXlogRecPtrResult(), ShowAllGUCConfig(), ShowGUCConfigOption(), and StartReplication().

◆ BlessTupleDesc()

◆ BuildTupleFromCStrings()

HeapTuple BuildTupleFromCStrings ( AttInMetadata attinmeta,
char **  values 
)

Definition at line 2222 of file execTuples.c.

2223 {
2224  TupleDesc tupdesc = attinmeta->tupdesc;
2225  int natts = tupdesc->natts;
2226  Datum *dvalues;
2227  bool *nulls;
2228  int i;
2229  HeapTuple tuple;
2230 
2231  dvalues = (Datum *) palloc(natts * sizeof(Datum));
2232  nulls = (bool *) palloc(natts * sizeof(bool));
2233 
2234  /*
2235  * Call the "in" function for each non-dropped attribute, even for nulls,
2236  * to support domains.
2237  */
2238  for (i = 0; i < natts; i++)
2239  {
2240  if (!TupleDescAttr(tupdesc, i)->attisdropped)
2241  {
2242  /* Non-dropped attributes */
2243  dvalues[i] = InputFunctionCall(&attinmeta->attinfuncs[i],
2244  values[i],
2245  attinmeta->attioparams[i],
2246  attinmeta->atttypmods[i]);
2247  if (values[i] != NULL)
2248  nulls[i] = false;
2249  else
2250  nulls[i] = true;
2251  }
2252  else
2253  {
2254  /* Handle dropped attributes by setting to NULL */
2255  dvalues[i] = (Datum) 0;
2256  nulls[i] = true;
2257  }
2258  }
2259 
2260  /*
2261  * Form a tuple
2262  */
2263  tuple = heap_form_tuple(tupdesc, dvalues, nulls);
2264 
2265  /*
2266  * Release locally palloc'd space. XXX would probably be good to pfree
2267  * values of pass-by-reference datums, as well.
2268  */
2269  pfree(dvalues);
2270  pfree(nulls);
2271 
2272  return tuple;
2273 }
static Datum values[MAXATTR]
Definition: bootstrap.c:152
Datum InputFunctionCall(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod)
Definition: fmgr.c:1530
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
Definition: heaptuple.c:1116
int i
Definition: isn.c:73
void pfree(void *pointer)
Definition: mcxt.c:1520
uintptr_t Datum
Definition: postgres.h:64
FmgrInfo * attinfuncs
Definition: funcapi.h:41
TupleDesc tupdesc
Definition: funcapi.h:38
Oid * attioparams
Definition: funcapi.h:44
int32 * atttypmods
Definition: funcapi.h:47
#define TupleDescAttr(tupdesc, i)
Definition: tupdesc.h:92

References AttInMetadata::attinfuncs, AttInMetadata::attioparams, AttInMetadata::atttypmods, heap_form_tuple(), i, InputFunctionCall(), TupleDescData::natts, palloc(), pfree(), AttInMetadata::tupdesc, TupleDescAttr, and values.

Referenced by bt_metap(), bt_multi_page_stats(), bt_page_stats_internal(), build_pgstattuple_type(), build_tuplestore_recursively(), crosstab(), dblink_get_pkey(), get_crosstab_tuplestore(), libpqrcv_processTuples(), materializeResult(), pg_get_keywords(), pg_get_multixact_members(), pgp_armor_headers(), pgrowlocks(), pgstatindex_impl(), pltcl_build_tuple_result(), prs_process_call(), show_all_settings(), storeRow(), ts_process_call(), tt_process_call(), and xpath_table().

◆ do_text_output_multiline()

void do_text_output_multiline ( TupOutputState tstate,
const char *  txt 
)

Definition at line 2390 of file execTuples.c.

2391 {
2392  Datum values[1];
2393  bool isnull[1] = {false};
2394 
2395  while (*txt)
2396  {
2397  const char *eol;
2398  int len;
2399 
2400  eol = strchr(txt, '\n');
2401  if (eol)
2402  {
2403  len = eol - txt;
2404  eol++;
2405  }
2406  else
2407  {
2408  len = strlen(txt);
2409  eol = txt + len;
2410  }
2411 
2413  do_tup_output(tstate, values, isnull);
2415  txt = eol;
2416  }
2417 }
void do_tup_output(TupOutputState *tstate, const Datum *values, const bool *isnull)
Definition: execTuples.c:2362
const void size_t len
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:322
static Pointer DatumGetPointer(Datum X)
Definition: postgres.h:312
text * cstring_to_text_with_len(const char *s, int len)
Definition: varlena.c:196

References cstring_to_text_with_len(), DatumGetPointer(), do_tup_output(), len, pfree(), PointerGetDatum(), and values.

Referenced by ExplainQuery().

◆ do_tup_output()

void do_tup_output ( TupOutputState tstate,
const Datum values,
const bool isnull 
)

Definition at line 2362 of file execTuples.c.

2363 {
2364  TupleTableSlot *slot = tstate->slot;
2365  int natts = slot->tts_tupleDescriptor->natts;
2366 
2367  /* make sure the slot is clear */
2368  ExecClearTuple(slot);
2369 
2370  /* insert data */
2371  memcpy(slot->tts_values, values, natts * sizeof(Datum));
2372  memcpy(slot->tts_isnull, isnull, natts * sizeof(bool));
2373 
2374  /* mark slot as containing a virtual tuple */
2375  ExecStoreVirtualTuple(slot);
2376 
2377  /* send the tuple to the receiver */
2378  (void) tstate->dest->receiveSlot(slot, tstate->dest);
2379 
2380  /* clean up */
2381  ExecClearTuple(slot);
2382 }
TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)
Definition: execTuples.c:1639
TupleDesc tts_tupleDescriptor
Definition: tuptable.h:123
bool * tts_isnull
Definition: tuptable.h:127
Datum * tts_values
Definition: tuptable.h:125
bool(* receiveSlot)(TupleTableSlot *slot, DestReceiver *self)
Definition: dest.h:118
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:454

References TupOutputState::dest, ExecClearTuple(), ExecStoreVirtualTuple(), TupleDescData::natts, _DestReceiver::receiveSlot, TupOutputState::slot, TupleTableSlot::tts_isnull, TupleTableSlot::tts_tupleDescriptor, TupleTableSlot::tts_values, and values.

Referenced by CreateReplicationSlot(), do_text_output_multiline(), IdentifySystem(), ReadReplicationSlot(), SendTablespaceList(), SendXlogRecPtrResult(), ShowAllGUCConfig(), and StartReplication().

◆ end_tup_output()

void end_tup_output ( TupOutputState tstate)

Definition at line 2420 of file execTuples.c.

2421 {
2422  tstate->dest->rShutdown(tstate->dest);
2423  /* note that destroying the dest is not ours to do */
2425  pfree(tstate);
2426 }
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
Definition: execTuples.c:1341
void(* rShutdown)(DestReceiver *self)
Definition: dest.h:124

References TupOutputState::dest, ExecDropSingleTupleTableSlot(), pfree(), _DestReceiver::rShutdown, and TupOutputState::slot.

Referenced by CreateReplicationSlot(), ExecuteCallStmt(), ExplainQuery(), IdentifySystem(), ReadReplicationSlot(), SendTablespaceList(), SendXlogRecPtrResult(), ShowAllGUCConfig(), ShowGUCConfigOption(), and StartReplication().

◆ 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().

◆ ExecCleanTypeFromTL()

TupleDesc ExecCleanTypeFromTL ( List targetList)

Definition at line 2037 of file execTuples.c.

2038 {
2039  return ExecTypeFromTLInternal(targetList, true);
2040 }
static TupleDesc ExecTypeFromTLInternal(List *targetList, bool skipjunk)
Definition: execTuples.c:2043

References ExecTypeFromTLInternal().

Referenced by ExecInitJunkFilter(), PlanCacheComputeResultDesc(), and PortalStart().

◆ 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 }
#define Assert(condition)
Definition: c.h:858
#define IsA(nodeptr, _type_)
Definition: nodes.h:158
void(* release)(TupleTableSlot *slot)
Definition: tuptable.h:143
const TupleTableSlotOps *const tts_ops
Definition: tuptable.h:121
#define ReleaseTupleDesc(tupdesc)
Definition: tupdesc.h:122
#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(), 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
HeapTuple(* copy_heap_tuple)(TupleTableSlot *slot)
Definition: tuptable.h:212
void(* materialize)(TupleTableSlot *slot)
Definition: tuptable.h:179
#define TTS_EMPTY(slot)
Definition: tuptable.h:96

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

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(* copy_minimal_tuple)(TupleTableSlot *slot)
Definition: tuptable.h:222
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 * 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().

◆ ExecInitExtraTupleSlot()

TupleTableSlot* ExecInitExtraTupleSlot ( EState estate,
TupleDesc  tupledesc,
const TupleTableSlotOps tts_ops 
)

◆ ExecInitNullTupleSlot()

TupleTableSlot* ExecInitNullTupleSlot ( EState estate,
TupleDesc  tupType,
const TupleTableSlotOps tts_ops 
)

Definition at line 1934 of file execTuples.c.

1936 {
1937  TupleTableSlot *slot = ExecInitExtraTupleSlot(estate, tupType, tts_ops);
1938 
1939  return ExecStoreAllNullTuple(slot);
1940 }
TupleTableSlot * ExecStoreAllNullTuple(TupleTableSlot *slot)
Definition: execTuples.c:1663
TupleTableSlot * ExecInitExtraTupleSlot(EState *estate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1918

References ExecInitExtraTupleSlot(), and ExecStoreAllNullTuple().

Referenced by ExecInitHashJoin(), ExecInitMergeJoin(), and ExecInitNestLoop().

◆ ExecInitResultSlot()

void ExecInitResultSlot ( PlanState planstate,
const TupleTableSlotOps tts_ops 
)

Definition at line 1866 of file execTuples.c.

1867 {
1868  TupleTableSlot *slot;
1869 
1870  slot = ExecAllocTableSlot(&planstate->state->es_tupleTable,
1871  planstate->ps_ResultTupleDesc, tts_ops);
1872  planstate->ps_ResultTupleSlot = slot;
1873 
1874  planstate->resultopsfixed = planstate->ps_ResultTupleDesc != NULL;
1875  planstate->resultops = tts_ops;
1876  planstate->resultopsset = true;
1877 }
const TupleTableSlotOps * resultops
Definition: execnodes.h:1194
bool resultopsset
Definition: execnodes.h:1202
EState * state
Definition: execnodes.h:1119
TupleDesc ps_ResultTupleDesc
Definition: execnodes.h:1154
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1155
bool resultopsfixed
Definition: execnodes.h:1198

References EState::es_tupleTable, ExecAllocTableSlot(), PlanState::ps_ResultTupleDesc, PlanState::ps_ResultTupleSlot, PlanState::resultops, PlanState::resultopsfixed, PlanState::resultopsset, and PlanState::state.

Referenced by ExecConditionalAssignProjectionInfo(), and ExecInitResultTupleSlotTL().

◆ ExecInitResultTupleSlotTL()

void ExecInitResultTupleSlotTL ( PlanState planstate,
const TupleTableSlotOps tts_ops 
)

◆ ExecInitResultTypeTL()

◆ ExecInitScanTupleSlot()

void ExecInitScanTupleSlot ( EState estate,
ScanState scanstate,
TupleDesc  tupledesc,
const TupleTableSlotOps tts_ops 
)

◆ 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:1180
#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:359
#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().

◆ ExecTypeFromExprList()

TupleDesc ExecTypeFromExprList ( List exprList)

Definition at line 2084 of file execTuples.c.

2085 {
2086  TupleDesc typeInfo;
2087  ListCell *lc;
2088  int cur_resno = 1;
2089 
2090  typeInfo = CreateTemplateTupleDesc(list_length(exprList));
2091 
2092  foreach(lc, exprList)
2093  {
2094  Node *e = lfirst(lc);
2095 
2096  TupleDescInitEntry(typeInfo,
2097  cur_resno,
2098  NULL,
2099  exprType(e),
2100  exprTypmod(e),
2101  0);
2102  TupleDescInitEntryCollation(typeInfo,
2103  cur_resno,
2104  exprCollation(e));
2105  cur_resno++;
2106  }
2107 
2108  return typeInfo;
2109 }
Oid exprType(const Node *expr)
Definition: nodeFuncs.c:42
int32 exprTypmod(const Node *expr)
Definition: nodeFuncs.c:298
Oid exprCollation(const Node *expr)
Definition: nodeFuncs.c:816
#define lfirst(lc)
Definition: pg_list.h:172
static int list_length(const List *l)
Definition: pg_list.h:152
e
Definition: preproc-init.c:82
Definition: nodes.h:129
TupleDesc CreateTemplateTupleDesc(int natts)
Definition: tupdesc.c:67
void TupleDescInitEntryCollation(TupleDesc desc, AttrNumber attributeNumber, Oid collationid)
Definition: tupdesc.c:833
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
Definition: tupdesc.c:651

References CreateTemplateTupleDesc(), exprCollation(), exprType(), exprTypmod(), lfirst, list_length(), TupleDescInitEntry(), and TupleDescInitEntryCollation().

Referenced by ExecInitExprRec(), ExecInitMemoize(), and ExecInitValuesScan().

◆ ExecTypeFromTL()

TupleDesc ExecTypeFromTL ( List targetList)

◆ ExecTypeFromTLInternal()

static TupleDesc ExecTypeFromTLInternal ( List targetList,
bool  skipjunk 
)
static

Definition at line 2043 of file execTuples.c.

2044 {
2045  TupleDesc typeInfo;
2046  ListCell *l;
2047  int len;
2048  int cur_resno = 1;
2049 
2050  if (skipjunk)
2051  len = ExecCleanTargetListLength(targetList);
2052  else
2053  len = ExecTargetListLength(targetList);
2054  typeInfo = CreateTemplateTupleDesc(len);
2055 
2056  foreach(l, targetList)
2057  {
2058  TargetEntry *tle = lfirst(l);
2059 
2060  if (skipjunk && tle->resjunk)
2061  continue;
2062  TupleDescInitEntry(typeInfo,
2063  cur_resno,
2064  tle->resname,
2065  exprType((Node *) tle->expr),
2066  exprTypmod((Node *) tle->expr),
2067  0);
2068  TupleDescInitEntryCollation(typeInfo,
2069  cur_resno,
2070  exprCollation((Node *) tle->expr));
2071  cur_resno++;
2072  }
2073 
2074  return typeInfo;
2075 }
int ExecTargetListLength(List *targetlist)
Definition: execUtils.c:1109
int ExecCleanTargetListLength(List *targetlist)
Definition: execUtils.c:1119
Expr * expr
Definition: primnodes.h:2162

References CreateTemplateTupleDesc(), ExecCleanTargetListLength(), ExecTargetListLength(), TargetEntry::expr, exprCollation(), exprType(), exprTypmod(), len, lfirst, TupleDescInitEntry(), and TupleDescInitEntryCollation().

Referenced by ExecCleanTypeFromTL(), and ExecTypeFromTL().

◆ ExecTypeSetColNames()

void ExecTypeSetColNames ( TupleDesc  typeInfo,
List namesList 
)

Definition at line 2117 of file execTuples.c.

2118 {
2119  int colno = 0;
2120  ListCell *lc;
2121 
2122  /* It's only OK to change col names in a not-yet-blessed RECORD type */
2123  Assert(typeInfo->tdtypeid == RECORDOID);
2124  Assert(typeInfo->tdtypmod < 0);
2125 
2126  foreach(lc, namesList)
2127  {
2128  char *cname = strVal(lfirst(lc));
2129  Form_pg_attribute attr;
2130 
2131  /* Guard against too-long names list (probably can't happen) */
2132  if (colno >= typeInfo->natts)
2133  break;
2134  attr = TupleDescAttr(typeInfo, colno);
2135  colno++;
2136 
2137  /*
2138  * Do nothing for empty aliases or dropped columns (these cases
2139  * probably can't arise in RECORD types, either)
2140  */
2141  if (cname[0] == '\0' || attr->attisdropped)
2142  continue;
2143 
2144  /* OK, assign the column name */
2145  namestrcpy(&(attr->attname), cname);
2146  }
2147 }
void namestrcpy(Name name, const char *str)
Definition: name.c:233
FormData_pg_attribute * Form_pg_attribute
Definition: pg_attribute.h:209
#define strVal(v)
Definition: value.h:82

References Assert, lfirst, namestrcpy(), TupleDescData::natts, strVal, TupleDescData::tdtypeid, TupleDescData::tdtypmod, and TupleDescAttr.

Referenced by ExecEvalWholeRowVar(), and ExecInitExprRec().

◆ HeapTupleHeaderGetDatum()

Datum HeapTupleHeaderGetDatum ( HeapTupleHeader  tuple)

Definition at line 2311 of file execTuples.c.

2312 {
2313  Datum result;
2314  TupleDesc tupDesc;
2315 
2316  /* No work if there are no external TOAST pointers in the tuple */
2317  if (!HeapTupleHeaderHasExternal(tuple))
2318  return PointerGetDatum(tuple);
2319 
2320  /* Use the type data saved by heap_form_tuple to look up the rowtype */
2322  HeapTupleHeaderGetTypMod(tuple));
2323 
2324  /* And do the flattening */
2325  result = toast_flatten_tuple_to_datum(tuple,
2327  tupDesc);
2328 
2329  ReleaseTupleDesc(tupDesc);
2330 
2331  return result;
2332 }
Datum toast_flatten_tuple_to_datum(HeapTupleHeader tup, uint32 tup_len, TupleDesc tupleDesc)
Definition: heaptoast.c:449
#define HeapTupleHeaderGetTypMod(tup)
Definition: htup_details.h:466
#define HeapTupleHeaderGetTypeId(tup)
Definition: htup_details.h:456
#define HeapTupleHeaderHasExternal(tup)
Definition: htup_details.h:537
TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod)
Definition: typcache.c:1833

References HeapTupleHeaderGetDatumLength, HeapTupleHeaderGetTypeId, HeapTupleHeaderGetTypMod, HeapTupleHeaderHasExternal, lookup_rowtype_tupdesc(), PointerGetDatum(), ReleaseTupleDesc, and toast_flatten_tuple_to_datum().

Referenced by HeapTupleGetDatum(), populate_composite(), and populate_recordset_record().

◆ 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:1346
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_deform_heap_tuple()

static pg_attribute_always_inline void slot_deform_heap_tuple ( TupleTableSlot slot,
HeapTuple  tuple,
uint32 offp,
int  natts 
)
static

Definition at line 1008 of file execTuples.c.

1010 {
1011  TupleDesc tupleDesc = slot->tts_tupleDescriptor;
1012  Datum *values = slot->tts_values;
1013  bool *isnull = slot->tts_isnull;
1014  HeapTupleHeader tup = tuple->t_data;
1015  bool hasnulls = HeapTupleHasNulls(tuple);
1016  int attnum;
1017  char *tp; /* ptr to tuple data */
1018  uint32 off; /* offset in tuple data */
1019  bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */
1020  bool slow; /* can we use/set attcacheoff? */
1021 
1022  /* We can only fetch as many attributes as the tuple has. */
1023  natts = Min(HeapTupleHeaderGetNatts(tuple->t_data), natts);
1024 
1025  /*
1026  * Check whether the first call for this tuple, and initialize or restore
1027  * loop state.
1028  */
1029  attnum = slot->tts_nvalid;
1030  if (attnum == 0)
1031  {
1032  /* Start from the first attribute */
1033  off = 0;
1034  slow = false;
1035  }
1036  else
1037  {
1038  /* Restore state from previous execution */
1039  off = *offp;
1040  slow = TTS_SLOW(slot);
1041  }
1042 
1043  tp = (char *) tup + tup->t_hoff;
1044 
1045  for (; attnum < natts; attnum++)
1046  {
1047  Form_pg_attribute thisatt = TupleDescAttr(tupleDesc, attnum);
1048 
1049  if (hasnulls && att_isnull(attnum, bp))
1050  {
1051  values[attnum] = (Datum) 0;
1052  isnull[attnum] = true;
1053  slow = true; /* can't use attcacheoff anymore */
1054  continue;
1055  }
1056 
1057  isnull[attnum] = false;
1058 
1059  if (!slow && thisatt->attcacheoff >= 0)
1060  off = thisatt->attcacheoff;
1061  else if (thisatt->attlen == -1)
1062  {
1063  /*
1064  * We can only cache the offset for a varlena attribute if the
1065  * offset is already suitably aligned, so that there would be no
1066  * pad bytes in any case: then the offset will be valid for either
1067  * an aligned or unaligned value.
1068  */
1069  if (!slow &&
1070  off == att_align_nominal(off, thisatt->attalign))
1071  thisatt->attcacheoff = off;
1072  else
1073  {
1074  off = att_align_pointer(off, thisatt->attalign, -1,
1075  tp + off);
1076  slow = true;
1077  }
1078  }
1079  else
1080  {
1081  /* not varlena, so safe to use att_align_nominal */
1082  off = att_align_nominal(off, thisatt->attalign);
1083 
1084  if (!slow)
1085  thisatt->attcacheoff = off;
1086  }
1087 
1088  values[attnum] = fetchatt(thisatt, tp + off);
1089 
1090  off = att_addlength_pointer(off, thisatt->attlen, tp + off);
1091 
1092  if (thisatt->attlen <= 0)
1093  slow = true; /* can't use attcacheoff anymore */
1094  }
1095 
1096  /*
1097  * Save state for next execution
1098  */
1099  slot->tts_nvalid = attnum;
1100  *offp = off;
1101  if (slow)
1102  slot->tts_flags |= TTS_FLAG_SLOW;
1103  else
1104  slot->tts_flags &= ~TTS_FLAG_SLOW;
1105 }
unsigned int uint32
Definition: c.h:506
#define Min(x, y)
Definition: c.h:1004
uint8 bits8
Definition: c.h:513
for(;;)
#define HeapTupleHeaderGetNatts(tup)
Definition: htup_details.h:529
#define HeapTupleHasNulls(tuple)
Definition: htup_details.h:659
int16 attnum
Definition: pg_attribute.h:74
bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]
Definition: htup_details.h:178
#define att_align_pointer(cur_offset, attalign, attlen, attptr)
Definition: tupmacs.h:107
#define att_align_nominal(cur_offset, attalign)
Definition: tupmacs.h:129
static bool att_isnull(int ATT, const bits8 *BITS)
Definition: tupmacs.h:26
#define att_addlength_pointer(cur_offset, attlen, attptr)
Definition: tupmacs.h:157
#define fetchatt(A, T)
Definition: tupmacs.h:46
#define TTS_FLAG_SLOW
Definition: tuptable.h:103
#define TTS_SLOW(slot)
Definition: tuptable.h:104

References att_addlength_pointer, att_align_nominal, att_align_pointer, att_isnull(), attnum, fetchatt, for(), HeapTupleHasNulls, HeapTupleHeaderGetNatts, Min, HeapTupleHeaderData::t_bits, HeapTupleData::t_data, HeapTupleHeaderData::t_hoff, TupleTableSlot::tts_isnull, TupleTableSlot::tts_nvalid, TTS_SLOW, TupleTableSlot::tts_tupleDescriptor, TupleTableSlot::tts_values, TupleDescAttr, and values.

Referenced by tts_buffer_heap_getsomeattrs(), tts_heap_getsomeattrs(), and tts_minimal_getsomeattrs().

◆ 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_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().

◆ tts_buffer_heap_clear()

static void tts_buffer_heap_clear ( TupleTableSlot slot)
static

Definition at line 719 of file execTuples.c.

720 {
722 
723  /*
724  * Free the memory for heap tuple if allowed. A tuple coming from buffer
725  * can never be freed. But we may have materialized a tuple from buffer.
726  * Such a tuple can be freed.
727  */
728  if (TTS_SHOULDFREE(slot))
729  {
730  /* We should have unpinned the buffer while materializing the tuple. */
731  Assert(!BufferIsValid(bslot->buffer));
732 
733  heap_freetuple(bslot->base.tuple);
734  slot->tts_flags &= ~TTS_FLAG_SHOULDFREE;
735  }
736 
737  if (BufferIsValid(bslot->buffer))
738  ReleaseBuffer(bslot->buffer);
739 
740  slot->tts_nvalid = 0;
741  slot->tts_flags |= TTS_FLAG_EMPTY;
743  bslot->base.tuple = NULL;
744  bslot->base.off = 0;
745  bslot->buffer = InvalidBuffer;
746 }
#define InvalidBuffer
Definition: buf.h:25
void ReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:4850
void heap_freetuple(HeapTuple htup)
Definition: heaptuple.c:1434
static void ItemPointerSetInvalid(ItemPointerData *pointer)
Definition: itemptr.h:184
ItemPointerData tts_tid
Definition: tuptable.h:129
#define TTS_SHOULDFREE(slot)
Definition: tuptable.h:100

References Assert, BufferHeapTupleTableSlot::buffer, BufferIsValid(), heap_freetuple(), InvalidBuffer, ItemPointerSetInvalid(), ReleaseBuffer(), TTS_FLAG_EMPTY, TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, TupleTableSlot::tts_nvalid, TTS_SHOULDFREE, and TupleTableSlot::tts_tid.

◆ tts_buffer_heap_copy_heap_tuple()

static HeapTuple tts_buffer_heap_copy_heap_tuple ( TupleTableSlot slot)
static

Definition at line 916 of file execTuples.c.

917 {
919 
920  Assert(!TTS_EMPTY(slot));
921 
922  if (!bslot->base.tuple)
924 
925  return heap_copytuple(bslot->base.tuple);
926 }
static void tts_buffer_heap_materialize(TupleTableSlot *slot)
Definition: execTuples.c:802

References Assert, heap_copytuple(), tts_buffer_heap_materialize(), and TTS_EMPTY.

◆ tts_buffer_heap_copy_minimal_tuple()

static MinimalTuple tts_buffer_heap_copy_minimal_tuple ( TupleTableSlot slot)
static

Definition at line 929 of file execTuples.c.

930 {
932 
933  Assert(!TTS_EMPTY(slot));
934 
935  if (!bslot->base.tuple)
937 
938  return minimal_tuple_from_heap_tuple(bslot->base.tuple);
939 }
MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup)
Definition: heaptuple.c:1576

References Assert, minimal_tuple_from_heap_tuple(), tts_buffer_heap_materialize(), and TTS_EMPTY.

◆ tts_buffer_heap_copyslot()

static void tts_buffer_heap_copyslot ( TupleTableSlot dstslot,
TupleTableSlot srcslot 
)
static

Definition at line 861 of file execTuples.c.

862 {
863  BufferHeapTupleTableSlot *bsrcslot = (BufferHeapTupleTableSlot *) srcslot;
864  BufferHeapTupleTableSlot *bdstslot = (BufferHeapTupleTableSlot *) dstslot;
865 
866  /*
867  * If the source slot is of a different kind, or is a buffer slot that has
868  * been materialized / is virtual, make a new copy of the tuple. Otherwise
869  * make a new reference to the in-buffer tuple.
870  */
871  if (dstslot->tts_ops != srcslot->tts_ops ||
872  TTS_SHOULDFREE(srcslot) ||
873  !bsrcslot->base.tuple)
874  {
875  MemoryContext oldContext;
876 
877  ExecClearTuple(dstslot);
878  dstslot->tts_flags &= ~TTS_FLAG_EMPTY;
879  oldContext = MemoryContextSwitchTo(dstslot->tts_mcxt);
880  bdstslot->base.tuple = ExecCopySlotHeapTuple(srcslot);
881  dstslot->tts_flags |= TTS_FLAG_SHOULDFREE;
882  MemoryContextSwitchTo(oldContext);
883  }
884  else
885  {
886  Assert(BufferIsValid(bsrcslot->buffer));
887 
888  tts_buffer_heap_store_tuple(dstslot, bsrcslot->base.tuple,
889  bsrcslot->buffer, false);
890 
891  /*
892  * The HeapTupleData portion of the source tuple might be shorter
893  * lived than the destination slot. Therefore copy the HeapTuple into
894  * our slot's tupdata, which is guaranteed to live long enough (but
895  * will still point into the buffer).
896  */
897  memcpy(&bdstslot->base.tupdata, bdstslot->base.tuple, sizeof(HeapTupleData));
898  bdstslot->base.tuple = &bdstslot->base.tupdata;
899  }
900 }
static HeapTuple ExecCopySlotHeapTuple(TupleTableSlot *slot)
Definition: tuptable.h:481

References Assert, BufferHeapTupleTableSlot::buffer, BufferIsValid(), ExecClearTuple(), ExecCopySlotHeapTuple(), MemoryContextSwitchTo(), tts_buffer_heap_store_tuple(), TTS_FLAG_EMPTY, TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, TupleTableSlot::tts_mcxt, TupleTableSlot::tts_ops, and TTS_SHOULDFREE.

◆ tts_buffer_heap_get_heap_tuple()

static HeapTuple tts_buffer_heap_get_heap_tuple ( TupleTableSlot slot)
static

Definition at line 903 of file execTuples.c.

904 {
906 
907  Assert(!TTS_EMPTY(slot));
908 
909  if (!bslot->base.tuple)
911 
912  return bslot->base.tuple;
913 }

References Assert, tts_buffer_heap_materialize(), and TTS_EMPTY.

◆ tts_buffer_heap_getsomeattrs()

static void tts_buffer_heap_getsomeattrs ( TupleTableSlot slot,
int  natts 
)
static

Definition at line 749 of file execTuples.c.

750 {
752 
753  Assert(!TTS_EMPTY(slot));
754 
755  slot_deform_heap_tuple(slot, bslot->base.tuple, &bslot->base.off, natts);
756 }
static pg_attribute_always_inline void slot_deform_heap_tuple(TupleTableSlot *slot, HeapTuple tuple, uint32 *offp, int natts)
Definition: execTuples.c:1008

References Assert, slot_deform_heap_tuple(), and TTS_EMPTY.

◆ tts_buffer_heap_getsysattr()

static Datum tts_buffer_heap_getsysattr ( TupleTableSlot slot,
int  attnum,
bool isnull 
)
static

Definition at line 759 of file execTuples.c.

760 {
762 
763  Assert(!TTS_EMPTY(slot));
764 
765  /*
766  * In some code paths it's possible to get here with a non-materialized
767  * slot, in which case we can't retrieve system columns.
768  */
769  if (!bslot->base.tuple)
770  ereport(ERROR,
771  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
772  errmsg("cannot retrieve a system column in this context")));
773 
774  return heap_getsysattr(bslot->base.tuple, attnum,
775  slot->tts_tupleDescriptor, isnull);
776 }
int errcode(int sqlerrcode)
Definition: elog.c:859
int errmsg(const char *fmt,...)
Definition: elog.c:1072
#define ereport(elevel,...)
Definition: elog.h:149
Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
Definition: heaptuple.c:723

References Assert, attnum, ereport, errcode(), errmsg(), ERROR, heap_getsysattr(), TTS_EMPTY, and TupleTableSlot::tts_tupleDescriptor.

◆ tts_buffer_heap_init()

static void tts_buffer_heap_init ( TupleTableSlot slot)
static

Definition at line 709 of file execTuples.c.

710 {
711 }

◆ tts_buffer_heap_materialize()

static void tts_buffer_heap_materialize ( TupleTableSlot slot)
static

Definition at line 802 of file execTuples.c.

803 {
805  MemoryContext oldContext;
806 
807  Assert(!TTS_EMPTY(slot));
808 
809  /* If slot has its tuple already materialized, nothing to do. */
810  if (TTS_SHOULDFREE(slot))
811  return;
812 
813  oldContext = MemoryContextSwitchTo(slot->tts_mcxt);
814 
815  /*
816  * Have to deform from scratch, otherwise tts_values[] entries could point
817  * into the non-materialized tuple (which might be gone when accessed).
818  */
819  bslot->base.off = 0;
820  slot->tts_nvalid = 0;
821 
822  if (!bslot->base.tuple)
823  {
824  /*
825  * Normally BufferHeapTupleTableSlot should have a tuple + buffer
826  * associated with it, unless it's materialized (which would've
827  * returned above). But when it's useful to allow storing virtual
828  * tuples in a buffer slot, which then also needs to be
829  * materializable.
830  */
831  bslot->base.tuple = heap_form_tuple(slot->tts_tupleDescriptor,
832  slot->tts_values,
833  slot->tts_isnull);
834  }
835  else
836  {
837  bslot->base.tuple = heap_copytuple(bslot->base.tuple);
838 
839  /*
840  * A heap tuple stored in a BufferHeapTupleTableSlot should have a
841  * buffer associated with it, unless it's materialized or virtual.
842  */
843  if (likely(BufferIsValid(bslot->buffer)))
844  ReleaseBuffer(bslot->buffer);
845  bslot->buffer = InvalidBuffer;
846  }
847 
848  /*
849  * We don't set TTS_FLAG_SHOULDFREE until after releasing the buffer, if
850  * any. This avoids having a transient state that would fall foul of our
851  * assertions that a slot with TTS_FLAG_SHOULDFREE doesn't own a buffer.
852  * In the unlikely event that ReleaseBuffer() above errors out, we'd
853  * effectively leak the copied tuple, but that seems fairly harmless.
854  */
856 
857  MemoryContextSwitchTo(oldContext);
858 }
#define likely(x)
Definition: c.h:310

References Assert, BufferHeapTupleTableSlot::buffer, BufferIsValid(), heap_copytuple(), heap_form_tuple(), InvalidBuffer, likely, MemoryContextSwitchTo(), ReleaseBuffer(), TTS_EMPTY, TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, TupleTableSlot::tts_isnull, TupleTableSlot::tts_mcxt, TupleTableSlot::tts_nvalid, TTS_SHOULDFREE, TupleTableSlot::tts_tupleDescriptor, and TupleTableSlot::tts_values.

Referenced by tts_buffer_heap_copy_heap_tuple(), tts_buffer_heap_copy_minimal_tuple(), and tts_buffer_heap_get_heap_tuple().

◆ tts_buffer_heap_release()

static void tts_buffer_heap_release ( TupleTableSlot slot)
static

Definition at line 714 of file execTuples.c.

715 {
716 }

◆ tts_buffer_heap_store_tuple()

static void tts_buffer_heap_store_tuple ( TupleTableSlot slot,
HeapTuple  tuple,
Buffer  buffer,
bool  transfer_pin 
)
inlinestatic

Definition at line 942 of file execTuples.c.

944 {
946 
947  if (TTS_SHOULDFREE(slot))
948  {
949  /* materialized slot shouldn't have a buffer to release */
950  Assert(!BufferIsValid(bslot->buffer));
951 
952  heap_freetuple(bslot->base.tuple);
953  slot->tts_flags &= ~TTS_FLAG_SHOULDFREE;
954  }
955 
956  slot->tts_flags &= ~TTS_FLAG_EMPTY;
957  slot->tts_nvalid = 0;
958  bslot->base.tuple = tuple;
959  bslot->base.off = 0;
960  slot->tts_tid = tuple->t_self;
961 
962  /*
963  * If tuple is on a disk page, keep the page pinned as long as we hold a
964  * pointer into it. We assume the caller already has such a pin. If
965  * transfer_pin is true, we'll transfer that pin to this slot, if not
966  * we'll pin it again ourselves.
967  *
968  * This is coded to optimize the case where the slot previously held a
969  * tuple on the same disk page: in that case releasing and re-acquiring
970  * the pin is a waste of cycles. This is a common situation during
971  * seqscans, so it's worth troubling over.
972  */
973  if (bslot->buffer != buffer)
974  {
975  if (BufferIsValid(bslot->buffer))
976  ReleaseBuffer(bslot->buffer);
977 
978  bslot->buffer = buffer;
979 
980  if (!transfer_pin && BufferIsValid(buffer))
981  IncrBufferRefCount(buffer);
982  }
983  else if (transfer_pin && BufferIsValid(buffer))
984  {
985  /*
986  * In transfer_pin mode the caller won't know about the same-page
987  * optimization, so we gotta release its pin.
988  */
989  ReleaseBuffer(buffer);
990  }
991 }
void IncrBufferRefCount(Buffer buffer)
Definition: bufmgr.c:4882

References Assert, BufferHeapTupleTableSlot::buffer, BufferIsValid(), heap_freetuple(), IncrBufferRefCount(), ReleaseBuffer(), HeapTupleData::t_self, TTS_FLAG_EMPTY, TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, TupleTableSlot::tts_nvalid, TTS_SHOULDFREE, and TupleTableSlot::tts_tid.

Referenced by ExecStoreBufferHeapTuple(), ExecStorePinnedBufferHeapTuple(), and tts_buffer_heap_copyslot().

◆ tts_buffer_is_current_xact_tuple()

static bool tts_buffer_is_current_xact_tuple ( TupleTableSlot slot)
static

Definition at line 779 of file execTuples.c.

780 {
782  TransactionId xmin;
783 
784  Assert(!TTS_EMPTY(slot));
785 
786  /*
787  * In some code paths it's possible to get here with a non-materialized
788  * slot, in which case we can't check if tuple is created by the current
789  * transaction.
790  */
791  if (!bslot->base.tuple)
792  ereport(ERROR,
793  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
794  errmsg("don't have a storage tuple in this context")));
795 
796  xmin = HeapTupleHeaderGetRawXmin(bslot->base.tuple->t_data);
797 
799 }
uint32 TransactionId
Definition: c.h:652
#define HeapTupleHeaderGetRawXmin(tup)
Definition: htup_details.h:304
bool TransactionIdIsCurrentTransactionId(TransactionId xid)
Definition: xact.c:938

References Assert, ereport, errcode(), errmsg(), ERROR, HeapTupleHeaderGetRawXmin, TransactionIdIsCurrentTransactionId(), and TTS_EMPTY.

◆ tts_heap_clear()

static void tts_heap_clear ( TupleTableSlot slot)
static

Definition at line 326 of file execTuples.c.

327 {
328  HeapTupleTableSlot *hslot = (HeapTupleTableSlot *) slot;
329 
330  /* Free the memory for the heap tuple if it's allowed. */
331  if (TTS_SHOULDFREE(slot))
332  {
333  heap_freetuple(hslot->tuple);
334  slot->tts_flags &= ~TTS_FLAG_SHOULDFREE;
335  }
336 
337  slot->tts_nvalid = 0;
338  slot->tts_flags |= TTS_FLAG_EMPTY;
340  hslot->off = 0;
341  hslot->tuple = NULL;
342 }
HeapTuple tuple
Definition: tuptable.h:260

References heap_freetuple(), ItemPointerSetInvalid(), HeapTupleTableSlot::off, TTS_FLAG_EMPTY, TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, TupleTableSlot::tts_nvalid, TTS_SHOULDFREE, TupleTableSlot::tts_tid, and HeapTupleTableSlot::tuple.

Referenced by tts_heap_store_tuple().

◆ tts_heap_copy_heap_tuple()

static HeapTuple tts_heap_copy_heap_tuple ( TupleTableSlot slot)
static

Definition at line 463 of file execTuples.c.

464 {
465  HeapTupleTableSlot *hslot = (HeapTupleTableSlot *) slot;
466 
467  Assert(!TTS_EMPTY(slot));
468  if (!hslot->tuple)
469  tts_heap_materialize(slot);
470 
471  return heap_copytuple(hslot->tuple);
472 }
static void tts_heap_materialize(TupleTableSlot *slot)
Definition: execTuples.c:398

References Assert, heap_copytuple(), TTS_EMPTY, tts_heap_materialize(), and HeapTupleTableSlot::tuple.

◆ tts_heap_copy_minimal_tuple()

static MinimalTuple tts_heap_copy_minimal_tuple ( TupleTableSlot slot)
static

Definition at line 475 of file execTuples.c.

476 {
477  HeapTupleTableSlot *hslot = (HeapTupleTableSlot *) slot;
478 
479  if (!hslot->tuple)
480  tts_heap_materialize(slot);
481 
482  return minimal_tuple_from_heap_tuple(hslot->tuple);
483 }

References minimal_tuple_from_heap_tuple(), tts_heap_materialize(), and HeapTupleTableSlot::tuple.

◆ tts_heap_copyslot()

static void tts_heap_copyslot ( TupleTableSlot dstslot,
TupleTableSlot srcslot 
)
static

Definition at line 438 of file execTuples.c.

439 {
440  HeapTuple tuple;
441  MemoryContext oldcontext;
442 
443  oldcontext = MemoryContextSwitchTo(dstslot->tts_mcxt);
444  tuple = ExecCopySlotHeapTuple(srcslot);
445  MemoryContextSwitchTo(oldcontext);
446 
447  ExecStoreHeapTuple(tuple, dstslot, true);
448 }

References ExecCopySlotHeapTuple(), ExecStoreHeapTuple(), MemoryContextSwitchTo(), and TupleTableSlot::tts_mcxt.

◆ tts_heap_get_heap_tuple()

static HeapTuple tts_heap_get_heap_tuple ( TupleTableSlot slot)
static

Definition at line 451 of file execTuples.c.

452 {
453  HeapTupleTableSlot *hslot = (HeapTupleTableSlot *) slot;
454 
455  Assert(!TTS_EMPTY(slot));
456  if (!hslot->tuple)
457  tts_heap_materialize(slot);
458 
459  return hslot->tuple;
460 }

References Assert, TTS_EMPTY, tts_heap_materialize(), and HeapTupleTableSlot::tuple.

◆ tts_heap_getsomeattrs()

static void tts_heap_getsomeattrs ( TupleTableSlot slot,
int  natts 
)
static

Definition at line 345 of file execTuples.c.

346 {
347  HeapTupleTableSlot *hslot = (HeapTupleTableSlot *) slot;
348 
349  Assert(!TTS_EMPTY(slot));
350 
351  slot_deform_heap_tuple(slot, hslot->tuple, &hslot->off, natts);
352 }

References Assert, HeapTupleTableSlot::off, slot_deform_heap_tuple(), TTS_EMPTY, and HeapTupleTableSlot::tuple.

◆ tts_heap_getsysattr()

static Datum tts_heap_getsysattr ( TupleTableSlot slot,
int  attnum,
bool isnull 
)
static

Definition at line 355 of file execTuples.c.

356 {
357  HeapTupleTableSlot *hslot = (HeapTupleTableSlot *) slot;
358 
359  Assert(!TTS_EMPTY(slot));
360 
361  /*
362  * In some code paths it's possible to get here with a non-materialized
363  * slot, in which case we can't retrieve system columns.
364  */
365  if (!hslot->tuple)
366  ereport(ERROR,
367  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
368  errmsg("cannot retrieve a system column in this context")));
369 
370  return heap_getsysattr(hslot->tuple, attnum,
371  slot->tts_tupleDescriptor, isnull);
372 }

References Assert, attnum, ereport, errcode(), errmsg(), ERROR, heap_getsysattr(), TTS_EMPTY, TupleTableSlot::tts_tupleDescriptor, and HeapTupleTableSlot::tuple.

◆ tts_heap_init()

static void tts_heap_init ( TupleTableSlot slot)
static

Definition at line 316 of file execTuples.c.

317 {
318 }

◆ tts_heap_is_current_xact_tuple()

static bool tts_heap_is_current_xact_tuple ( TupleTableSlot slot)
static

Definition at line 375 of file execTuples.c.

376 {
377  HeapTupleTableSlot *hslot = (HeapTupleTableSlot *) slot;
378  TransactionId xmin;
379 
380  Assert(!TTS_EMPTY(slot));
381 
382  /*
383  * In some code paths it's possible to get here with a non-materialized
384  * slot, in which case we can't check if tuple is created by the current
385  * transaction.
386  */
387  if (!hslot->tuple)
388  ereport(ERROR,
389  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
390  errmsg("don't have a storage tuple in this context")));
391 
392  xmin = HeapTupleHeaderGetRawXmin(hslot->tuple->t_data);
393 
395 }

References Assert, ereport, errcode(), errmsg(), ERROR, HeapTupleHeaderGetRawXmin, HeapTupleData::t_data, TransactionIdIsCurrentTransactionId(), TTS_EMPTY, and HeapTupleTableSlot::tuple.

◆ tts_heap_materialize()

static void tts_heap_materialize ( TupleTableSlot slot)
static

Definition at line 398 of file execTuples.c.

399 {
400  HeapTupleTableSlot *hslot = (HeapTupleTableSlot *) slot;
401  MemoryContext oldContext;
402 
403  Assert(!TTS_EMPTY(slot));
404 
405  /* If slot has its tuple already materialized, nothing to do. */
406  if (TTS_SHOULDFREE(slot))
407  return;
408 
409  oldContext = MemoryContextSwitchTo(slot->tts_mcxt);
410 
411  /*
412  * Have to deform from scratch, otherwise tts_values[] entries could point
413  * into the non-materialized tuple (which might be gone when accessed).
414  */
415  slot->tts_nvalid = 0;
416  hslot->off = 0;
417 
418  if (!hslot->tuple)
420  slot->tts_values,
421  slot->tts_isnull);
422  else
423  {
424  /*
425  * The tuple contained in this slot is not allocated in the memory
426  * context of the given slot (else it would have TTS_FLAG_SHOULDFREE
427  * set). Copy the tuple into the given slot's memory context.
428  */
429  hslot->tuple = heap_copytuple(hslot->tuple);
430  }
431 
433 
434  MemoryContextSwitchTo(oldContext);
435 }

References Assert, heap_copytuple(), heap_form_tuple(), MemoryContextSwitchTo(), HeapTupleTableSlot::off, TTS_EMPTY, TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, TupleTableSlot::tts_isnull, TupleTableSlot::tts_mcxt, TupleTableSlot::tts_nvalid, TTS_SHOULDFREE, TupleTableSlot::tts_tupleDescriptor, TupleTableSlot::tts_values, and HeapTupleTableSlot::tuple.

Referenced by tts_heap_copy_heap_tuple(), tts_heap_copy_minimal_tuple(), and tts_heap_get_heap_tuple().

◆ tts_heap_release()

static void tts_heap_release ( TupleTableSlot slot)
static

Definition at line 321 of file execTuples.c.

322 {
323 }

◆ tts_heap_store_tuple()

static void tts_heap_store_tuple ( TupleTableSlot slot,
HeapTuple  tuple,
bool  shouldFree 
)
static

Definition at line 486 of file execTuples.c.

487 {
488  HeapTupleTableSlot *hslot = (HeapTupleTableSlot *) slot;
489 
490  tts_heap_clear(slot);
491 
492  slot->tts_nvalid = 0;
493  hslot->tuple = tuple;
494  hslot->off = 0;
496  slot->tts_tid = tuple->t_self;
497 
498  if (shouldFree)
500 }
static void tts_heap_clear(TupleTableSlot *slot)
Definition: execTuples.c:326

References HeapTupleTableSlot::off, HeapTupleData::t_self, TTS_FLAG_EMPTY, TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, tts_heap_clear(), TupleTableSlot::tts_nvalid, TupleTableSlot::tts_tid, and HeapTupleTableSlot::tuple.

Referenced by ExecStoreHeapTuple().

◆ tts_minimal_clear()

static void tts_minimal_clear ( TupleTableSlot slot)
static

Definition at line 525 of file execTuples.c.

526 {
528 
529  if (TTS_SHOULDFREE(slot))
530  {
532  slot->tts_flags &= ~TTS_FLAG_SHOULDFREE;
533  }
534 
535  slot->tts_nvalid = 0;
536  slot->tts_flags |= TTS_FLAG_EMPTY;
538  mslot->off = 0;
539  mslot->mintuple = NULL;
540 }
void heap_free_minimal_tuple(MinimalTuple mtup)
Definition: heaptuple.c:1523
MinimalTuple mintuple
Definition: tuptable.h:297

References heap_free_minimal_tuple(), ItemPointerSetInvalid(), MinimalTupleTableSlot::mintuple, MinimalTupleTableSlot::off, TTS_FLAG_EMPTY, TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, TupleTableSlot::tts_nvalid, TTS_SHOULDFREE, and TupleTableSlot::tts_tid.

Referenced by tts_minimal_store_tuple().

◆ tts_minimal_copy_heap_tuple()

static HeapTuple tts_minimal_copy_heap_tuple ( TupleTableSlot slot)
static

Definition at line 658 of file execTuples.c.

659 {
661 
662  if (!mslot->mintuple)
664 
666 }
static void tts_minimal_materialize(TupleTableSlot *slot)
Definition: execTuples.c:586
HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup)
Definition: heaptuple.c:1554

References heap_tuple_from_minimal_tuple(), MinimalTupleTableSlot::mintuple, and tts_minimal_materialize().

◆ tts_minimal_copy_minimal_tuple()

static MinimalTuple tts_minimal_copy_minimal_tuple ( TupleTableSlot slot)
static

Definition at line 669 of file execTuples.c.

670 {
672 
673  if (!mslot->mintuple)
675 
676  return heap_copy_minimal_tuple(mslot->mintuple);
677 }
MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup)
Definition: heaptuple.c:1535

References heap_copy_minimal_tuple(), MinimalTupleTableSlot::mintuple, and tts_minimal_materialize().

◆ tts_minimal_copyslot()

static void tts_minimal_copyslot ( TupleTableSlot dstslot,
TupleTableSlot srcslot 
)
static

Definition at line 634 of file execTuples.c.

635 {
636  MemoryContext oldcontext;
637  MinimalTuple mintuple;
638 
639  oldcontext = MemoryContextSwitchTo(dstslot->tts_mcxt);
640  mintuple = ExecCopySlotMinimalTuple(srcslot);
641  MemoryContextSwitchTo(oldcontext);
642 
643  ExecStoreMinimalTuple(mintuple, dstslot, true);
644 }
TupleTableSlot * ExecStoreMinimalTuple(MinimalTuple mtup, TupleTableSlot *slot, bool shouldFree)
Definition: execTuples.c:1533
static MinimalTuple ExecCopySlotMinimalTuple(TupleTableSlot *slot)
Definition: tuptable.h:492

References ExecCopySlotMinimalTuple(), ExecStoreMinimalTuple(), MemoryContextSwitchTo(), and TupleTableSlot::tts_mcxt.

◆ tts_minimal_get_minimal_tuple()

static MinimalTuple tts_minimal_get_minimal_tuple ( TupleTableSlot slot)
static

Definition at line 647 of file execTuples.c.

648 {
650 
651  if (!mslot->mintuple)
653 
654  return mslot->mintuple;
655 }

References MinimalTupleTableSlot::mintuple, and tts_minimal_materialize().

◆ tts_minimal_getsomeattrs()

static void tts_minimal_getsomeattrs ( TupleTableSlot slot,
int  natts 
)
static

Definition at line 543 of file execTuples.c.

544 {
546 
547  Assert(!TTS_EMPTY(slot));
548 
549  slot_deform_heap_tuple(slot, mslot->tuple, &mslot->off, natts);
550 }

References Assert, MinimalTupleTableSlot::off, slot_deform_heap_tuple(), TTS_EMPTY, and MinimalTupleTableSlot::tuple.

◆ tts_minimal_getsysattr()

static Datum tts_minimal_getsysattr ( TupleTableSlot slot,
int  attnum,
bool isnull 
)
static

Definition at line 557 of file execTuples.c.

558 {
559  Assert(!TTS_EMPTY(slot));
560 
561  ereport(ERROR,
562  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
563  errmsg("cannot retrieve a system column in this context")));
564 
565  return 0; /* silence compiler warnings */
566 }

References Assert, ereport, errcode(), errmsg(), ERROR, and TTS_EMPTY.

◆ tts_minimal_init()

static void tts_minimal_init ( TupleTableSlot slot)
static

Definition at line 508 of file execTuples.c.

509 {
511 
512  /*
513  * Initialize the heap tuple pointer to access attributes of the minimal
514  * tuple contained in the slot as if its a heap tuple.
515  */
516  mslot->tuple = &mslot->minhdr;
517 }
HeapTupleData minhdr
Definition: tuptable.h:298

References MinimalTupleTableSlot::minhdr, and MinimalTupleTableSlot::tuple.

◆ tts_minimal_is_current_xact_tuple()

static bool tts_minimal_is_current_xact_tuple ( TupleTableSlot slot)
static

Definition at line 574 of file execTuples.c.

575 {
576  Assert(!TTS_EMPTY(slot));
577 
578  ereport(ERROR,
579  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
580  errmsg("don't have transaction information for this type of tuple")));
581 
582  return false; /* silence compiler warnings */
583 }

References Assert, ereport, errcode(), errmsg(), ERROR, and TTS_EMPTY.

◆ tts_minimal_materialize()

static void tts_minimal_materialize ( TupleTableSlot slot)
static

Definition at line 586 of file execTuples.c.

587 {
589  MemoryContext oldContext;
590 
591  Assert(!TTS_EMPTY(slot));
592 
593  /* If slot has its tuple already materialized, nothing to do. */
594  if (TTS_SHOULDFREE(slot))
595  return;
596 
597  oldContext = MemoryContextSwitchTo(slot->tts_mcxt);
598 
599  /*
600  * Have to deform from scratch, otherwise tts_values[] entries could point
601  * into the non-materialized tuple (which might be gone when accessed).
602  */
603  slot->tts_nvalid = 0;
604  mslot->off = 0;
605 
606  if (!mslot->mintuple)
607  {
609  slot->tts_values,
610  slot->tts_isnull);
611  }
612  else
613  {
614  /*
615  * The minimal tuple contained in this slot is not allocated in the
616  * memory context of the given slot (else it would have
617  * TTS_FLAG_SHOULDFREE set). Copy the minimal tuple into the given
618  * slot's memory context.
619  */
620  mslot->mintuple = heap_copy_minimal_tuple(mslot->mintuple);
621  }
622 
624 
625  Assert(mslot->tuple == &mslot->minhdr);
626 
627  mslot->minhdr.t_len = mslot->mintuple->t_len + MINIMAL_TUPLE_OFFSET;
628  mslot->minhdr.t_data = (HeapTupleHeader) ((char *) mslot->mintuple - MINIMAL_TUPLE_OFFSET);
629 
630  MemoryContextSwitchTo(oldContext);
631 }
MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
Definition: heaptuple.c:1452

References Assert, heap_copy_minimal_tuple(), heap_form_minimal_tuple(), MemoryContextSwitchTo(), MinimalTupleTableSlot::minhdr, MINIMAL_TUPLE_OFFSET, MinimalTupleTableSlot::mintuple, MinimalTupleTableSlot::off, HeapTupleData::t_data, HeapTupleData::t_len, MinimalTupleData::t_len, TTS_EMPTY, TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, TupleTableSlot::tts_isnull, TupleTableSlot::tts_mcxt, TupleTableSlot::tts_nvalid, TTS_SHOULDFREE, TupleTableSlot::tts_tupleDescriptor, TupleTableSlot::tts_values, and MinimalTupleTableSlot::tuple.

Referenced by tts_minimal_copy_heap_tuple(), tts_minimal_copy_minimal_tuple(), and tts_minimal_get_minimal_tuple().

◆ tts_minimal_release()

static void tts_minimal_release ( TupleTableSlot slot)
static

Definition at line 520 of file execTuples.c.

521 {
522 }

◆ tts_minimal_store_tuple()

static void tts_minimal_store_tuple ( TupleTableSlot slot,
MinimalTuple  mtup,
bool  shouldFree 
)
static

Definition at line 680 of file execTuples.c.

681 {
683 
684  tts_minimal_clear(slot);
685 
686  Assert(!TTS_SHOULDFREE(slot));
687  Assert(TTS_EMPTY(slot));
688 
689  slot->tts_flags &= ~TTS_FLAG_EMPTY;
690  slot->tts_nvalid = 0;
691  mslot->off = 0;
692 
693  mslot->mintuple = mtup;
694  Assert(mslot->tuple == &mslot->minhdr);
695  mslot->minhdr.t_len = mtup->t_len + MINIMAL_TUPLE_OFFSET;
696  mslot->minhdr.t_data = (HeapTupleHeader) ((char *) mtup - MINIMAL_TUPLE_OFFSET);
697  /* no need to set t_self or t_tableOid since we won't allow access */
698 
699  if (shouldFree)
701 }
static void tts_minimal_clear(TupleTableSlot *slot)
Definition: execTuples.c:525

References Assert, MinimalTupleTableSlot::minhdr, MINIMAL_TUPLE_OFFSET, MinimalTupleTableSlot::mintuple, MinimalTupleTableSlot::off, HeapTupleData::t_data, HeapTupleData::t_len, MinimalTupleData::t_len, TTS_EMPTY, TTS_FLAG_EMPTY, TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, tts_minimal_clear(), TupleTableSlot::tts_nvalid, TTS_SHOULDFREE, and MinimalTupleTableSlot::tuple.

Referenced by ExecForceStoreMinimalTuple(), and ExecStoreMinimalTuple().

◆ tts_virtual_clear()

static void tts_virtual_clear ( TupleTableSlot slot)
static

Definition at line 108 of file execTuples.c.

109 {
110  if (unlikely(TTS_SHOULDFREE(slot)))
111  {
113 
114  pfree(vslot->data);
115  vslot->data = NULL;
116 
117  slot->tts_flags &= ~TTS_FLAG_SHOULDFREE;
118  }
119 
120  slot->tts_nvalid = 0;
121  slot->tts_flags |= TTS_FLAG_EMPTY;
123 }

References VirtualTupleTableSlot::data, ItemPointerSetInvalid(), pfree(), TTS_FLAG_EMPTY, TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, TupleTableSlot::tts_nvalid, TTS_SHOULDFREE, TupleTableSlot::tts_tid, and unlikely.

Referenced by tts_virtual_copyslot().

◆ tts_virtual_copy_heap_tuple()

static HeapTuple tts_virtual_copy_heap_tuple ( TupleTableSlot slot)
static

Definition at line 291 of file execTuples.c.

292 {
293  Assert(!TTS_EMPTY(slot));
294 
296  slot->tts_values,
297  slot->tts_isnull);
298 }

References Assert, heap_form_tuple(), TTS_EMPTY, TupleTableSlot::tts_isnull, TupleTableSlot::tts_tupleDescriptor, and TupleTableSlot::tts_values.

◆ tts_virtual_copy_minimal_tuple()

static MinimalTuple tts_virtual_copy_minimal_tuple ( TupleTableSlot slot)
static

Definition at line 301 of file execTuples.c.

302 {
303  Assert(!TTS_EMPTY(slot));
304 
306  slot->tts_values,
307  slot->tts_isnull);
308 }

References Assert, heap_form_minimal_tuple(), TTS_EMPTY, TupleTableSlot::tts_isnull, TupleTableSlot::tts_tupleDescriptor, and TupleTableSlot::tts_values.

◆ tts_virtual_copyslot()

static void tts_virtual_copyslot ( TupleTableSlot dstslot,
TupleTableSlot srcslot 
)
static

Definition at line 269 of file execTuples.c.

270 {
271  TupleDesc srcdesc = srcslot->tts_tupleDescriptor;
272 
273  tts_virtual_clear(dstslot);
274 
275  slot_getallattrs(srcslot);
276 
277  for (int natt = 0; natt < srcdesc->natts; natt++)
278  {
279  dstslot->tts_values[natt] = srcslot->tts_values[natt];
280  dstslot->tts_isnull[natt] = srcslot->tts_isnull[natt];
281  }
282 
283  dstslot->tts_nvalid = srcdesc->natts;
284  dstslot->tts_flags &= ~TTS_FLAG_EMPTY;
285 
286  /* make sure storage doesn't depend on external memory */
287  tts_virtual_materialize(dstslot);
288 }
static void tts_virtual_clear(TupleTableSlot *slot)
Definition: execTuples.c:108
static void tts_virtual_materialize(TupleTableSlot *slot)
Definition: execTuples.c:176
static void slot_getallattrs(TupleTableSlot *slot)
Definition: tuptable.h:368

References TupleDescData::natts, slot_getallattrs(), TTS_FLAG_EMPTY, TupleTableSlot::tts_flags, TupleTableSlot::tts_isnull, TupleTableSlot::tts_nvalid, TupleTableSlot::tts_tupleDescriptor, TupleTableSlot::tts_values, tts_virtual_clear(), and tts_virtual_materialize().

◆ tts_virtual_getsomeattrs()

static void tts_virtual_getsomeattrs ( TupleTableSlot slot,
int  natts 
)
static

Definition at line 130 of file execTuples.c.

131 {
132  elog(ERROR, "getsomeattrs is not required to be called on a virtual tuple table slot");
133 }

References elog, and ERROR.

◆ tts_virtual_getsysattr()

static Datum tts_virtual_getsysattr ( TupleTableSlot slot,
int  attnum,
bool isnull 
)
static

Definition at line 141 of file execTuples.c.

142 {
143  Assert(!TTS_EMPTY(slot));
144 
145  ereport(ERROR,
146  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
147  errmsg("cannot retrieve a system column in this context")));
148 
149  return 0; /* silence compiler warnings */
150 }

References Assert, ereport, errcode(), errmsg(), ERROR, and TTS_EMPTY.

◆ tts_virtual_init()

static void tts_virtual_init ( TupleTableSlot slot)
static

Definition at line 98 of file execTuples.c.

99 {
100 }

◆ tts_virtual_is_current_xact_tuple()

static bool tts_virtual_is_current_xact_tuple ( TupleTableSlot slot)
static

Definition at line 157 of file execTuples.c.

158 {
159  Assert(!TTS_EMPTY(slot));
160 
161  ereport(ERROR,
162  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
163  errmsg("don't have transaction information for this type of tuple")));
164 
165  return false; /* silence compiler warnings */
166 }

References Assert, ereport, errcode(), errmsg(), ERROR, and TTS_EMPTY.

◆ tts_virtual_materialize()

static void tts_virtual_materialize ( TupleTableSlot slot)
static

Definition at line 176 of file execTuples.c.

177 {
179  TupleDesc desc = slot->tts_tupleDescriptor;
180  Size sz = 0;
181  char *data;
182 
183  /* already materialized */
184  if (TTS_SHOULDFREE(slot))
185  return;
186 
187  /* compute size of memory required */
188  for (int natt = 0; natt < desc->natts; natt++)
189  {
190  Form_pg_attribute att = TupleDescAttr(desc, natt);
191  Datum val;
192 
193  if (att->attbyval || slot->tts_isnull[natt])
194  continue;
195 
196  val = slot->tts_values[natt];
197 
198  if (att->attlen == -1 &&
200  {
201  /*
202  * We want to flatten the expanded value so that the materialized
203  * slot doesn't depend on it.
204  */
205  sz = att_align_nominal(sz, att->attalign);
207  }
208  else
209  {
210  sz = att_align_nominal(sz, att->attalign);
211  sz = att_addlength_datum(sz, att->attlen, val);
212  }
213  }
214 
215  /* all data is byval */
216  if (sz == 0)
217  return;
218 
219  /* allocate memory */
220  vslot->data = data = MemoryContextAlloc(slot->tts_mcxt, sz);
222 
223  /* and copy all attributes into the pre-allocated space */
224  for (int natt = 0; natt < desc->natts; natt++)
225  {
226  Form_pg_attribute att = TupleDescAttr(desc, natt);
227  Datum val;
228 
229  if (att->attbyval || slot->tts_isnull[natt])
230  continue;
231 
232  val = slot->tts_values[natt];
233 
234  if (att->attlen == -1 &&
236  {
237  Size data_length;
238 
239  /*
240  * We want to flatten the expanded value so that the materialized
241  * slot doesn't depend on it.
242  */
244 
245  data = (char *) att_align_nominal(data,
246  att->attalign);
247  data_length = EOH_get_flat_size(eoh);
248  EOH_flatten_into(eoh, data, data_length);
249 
250  slot->tts_values[natt] = PointerGetDatum(data);
251  data += data_length;
252  }
253  else
254  {
255  Size data_length = 0;
256 
257  data = (char *) att_align_nominal(data, att->attalign);
258  data_length = att_addlength_datum(data_length, att->attlen, val);
259 
260  memcpy(data, DatumGetPointer(val), data_length);
261 
262  slot->tts_values[natt] = PointerGetDatum(data);
263  data += data_length;
264  }
265  }
266 }
ExpandedObjectHeader * DatumGetEOHP(Datum d)
Definition: expandeddatum.c:29
void EOH_flatten_into(ExpandedObjectHeader *eohptr, void *result, Size allocated_size)
Definition: expandeddatum.c:81
Size EOH_get_flat_size(ExpandedObjectHeader *eohptr)
Definition: expandeddatum.c:75
long val
Definition: informix.c:670
#define att_addlength_datum(cur_offset, attlen, attdatum)
Definition: tupmacs.h:145
#define VARATT_IS_EXTERNAL_EXPANDED(PTR)
Definition: varatt.h:298

References att_addlength_datum, att_align_nominal, VirtualTupleTableSlot::data, data, DatumGetEOHP(), DatumGetPointer(), EOH_flatten_into(), EOH_get_flat_size(), MemoryContextAlloc(), TupleDescData::natts, PointerGetDatum(), TTS_FLAG_SHOULDFREE, TupleTableSlot::tts_flags, TupleTableSlot::tts_isnull, TupleTableSlot::tts_mcxt, TTS_SHOULDFREE, TupleTableSlot::tts_tupleDescriptor, TupleTableSlot::tts_values, TupleDescAttr, val, and VARATT_IS_EXTERNAL_EXPANDED.

Referenced by tts_virtual_copyslot().

◆ tts_virtual_release()

static void tts_virtual_release ( TupleTableSlot slot)
static

Definition at line 103 of file execTuples.c.

104 {
105 }

◆ TupleDescGetAttInMetadata()

AttInMetadata* TupleDescGetAttInMetadata ( TupleDesc  tupdesc)

Definition at line 2173 of file execTuples.c.

2174 {
2175  int natts = tupdesc->natts;
2176  int i;
2177  Oid atttypeid;
2178  Oid attinfuncid;
2179  FmgrInfo *attinfuncinfo;
2180  Oid *attioparams;
2181  int32 *atttypmods;
2182  AttInMetadata *attinmeta;
2183 
2184  attinmeta = (AttInMetadata *) palloc(sizeof(AttInMetadata));
2185 
2186  /* "Bless" the tupledesc so that we can make rowtype datums with it */
2187  attinmeta->tupdesc = BlessTupleDesc(tupdesc);
2188 
2189  /*
2190  * Gather info needed later to call the "in" function for each attribute
2191  */
2192  attinfuncinfo = (FmgrInfo *) palloc0(natts * sizeof(FmgrInfo));
2193  attioparams = (Oid *) palloc0(natts * sizeof(Oid));
2194  atttypmods = (int32 *) palloc0(natts * sizeof(int32));
2195 
2196  for (i = 0; i < natts; i++)
2197  {
2198  Form_pg_attribute att = TupleDescAttr(tupdesc, i);
2199 
2200  /* Ignore dropped attributes */
2201  if (!att->attisdropped)
2202  {
2203  atttypeid = att->atttypid;
2204  getTypeInputInfo(atttypeid, &attinfuncid, &attioparams[i]);
2205  fmgr_info(attinfuncid, &attinfuncinfo[i]);
2206  atttypmods[i] = att->atttypmod;
2207  }
2208  }
2209  attinmeta->attinfuncs = attinfuncinfo;
2210  attinmeta->attioparams = attioparams;
2211  attinmeta->atttypmods = atttypmods;
2212 
2213  return attinmeta;
2214 }
signed int int32
Definition: c.h:494
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
Definition: execTuples.c:2158
void fmgr_info(Oid functionId, FmgrInfo *finfo)
Definition: fmgr.c:127
void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam)
Definition: lsyscache.c:2874
unsigned int Oid
Definition: postgres_ext.h:31
Definition: fmgr.h:57

References AttInMetadata::attinfuncs, AttInMetadata::attioparams, AttInMetadata::atttypmods, BlessTupleDesc(), fmgr_info(), getTypeInputInfo(), i, TupleDescData::natts, palloc(), palloc0(), AttInMetadata::tupdesc, and TupleDescAttr.

Referenced by bt_metap(), bt_multi_page_stats(), bt_page_stats_internal(), build_pgstattuple_type(), connectby_text(), connectby_text_serial(), create_foreign_modify(), crosstab(), dblink_get_pkey(), get_crosstab_tuplestore(), hash_page_items(), libpqrcv_processTuples(), materializeResult(), pg_get_keywords(), pg_get_multixact_members(), pg_stats_ext_mcvlist_items(), pgp_armor_headers(), pgrowlocks(), pgstatindex_impl(), pltcl_build_tuple_result(), pltcl_func_handler(), pltcl_init_tuple_store(), postgresAcquireSampleRowsFunc(), postgresBeginDirectModify(), postgresBeginForeignScan(), prs_setup_firstcall(), show_all_settings(), storeRow(), ts_setup_firstcall(), tt_setup_firstcall(), and xpath_table().

Variable Documentation

◆ TTSOpsBufferHeapTuple

const TupleTableSlotOps TTSOpsBufferHeapTuple
Initial value:
= {
.base_slot_size = sizeof(BufferHeapTupleTableSlot),
.is_current_xact_tuple = tts_buffer_is_current_xact_tuple,
.get_heap_tuple = tts_buffer_heap_get_heap_tuple,
.get_minimal_tuple = NULL,
.copy_heap_tuple = tts_buffer_heap_copy_heap_tuple,
.copy_minimal_tuple = tts_buffer_heap_copy_minimal_tuple
}
static void tts_buffer_heap_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
Definition: execTuples.c:861
static HeapTuple tts_buffer_heap_copy_heap_tuple(TupleTableSlot *slot)
Definition: execTuples.c:916
static void tts_buffer_heap_clear(TupleTableSlot *slot)
Definition: execTuples.c:719
static Datum tts_buffer_heap_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
Definition: execTuples.c:759
static bool tts_buffer_is_current_xact_tuple(TupleTableSlot *slot)
Definition: execTuples.c:779
static HeapTuple tts_buffer_heap_get_heap_tuple(TupleTableSlot *slot)
Definition: execTuples.c:903
static void tts_buffer_heap_release(TupleTableSlot *slot)
Definition: execTuples.c:714
static MinimalTuple tts_buffer_heap_copy_minimal_tuple(TupleTableSlot *slot)
Definition: execTuples.c:929
static void tts_buffer_heap_getsomeattrs(TupleTableSlot *slot, int natts)
Definition: execTuples.c:749
static void tts_buffer_heap_init(TupleTableSlot *slot)
Definition: execTuples.c:709
int init
Definition: isn.c:75
struct BufferHeapTupleTableSlot BufferHeapTupleTableSlot

Definition at line 87 of file execTuples.c.

Referenced by CheckOpSlotCompatibility(), heapam_slot_callbacks(), and slot_compile_deform().

◆ TTSOpsHeapTuple

const TupleTableSlotOps TTSOpsHeapTuple
Initial value:
= {
.base_slot_size = sizeof(HeapTupleTableSlot),
.release = tts_heap_release,
.clear = tts_heap_clear,
.getsomeattrs = tts_heap_getsomeattrs,
.getsysattr = tts_heap_getsysattr,
.is_current_xact_tuple = tts_heap_is_current_xact_tuple,
.materialize = tts_heap_materialize,
.copyslot = tts_heap_copyslot,
.get_heap_tuple = tts_heap_get_heap_tuple,
.get_minimal_tuple = NULL,
.copy_heap_tuple = tts_heap_copy_heap_tuple,
.copy_minimal_tuple = tts_heap_copy_minimal_tuple
}
static Datum tts_heap_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
Definition: execTuples.c:355
static MinimalTuple tts_heap_copy_minimal_tuple(TupleTableSlot *slot)
Definition: execTuples.c:475
static void tts_heap_init(TupleTableSlot *slot)
Definition: execTuples.c:316
static HeapTuple tts_heap_copy_heap_tuple(TupleTableSlot *slot)
Definition: execTuples.c:463
static HeapTuple tts_heap_get_heap_tuple(TupleTableSlot *slot)
Definition: execTuples.c:451
static void tts_heap_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
Definition: execTuples.c:438
static void tts_heap_getsomeattrs(TupleTableSlot *slot, int natts)
Definition: execTuples.c:345
static void tts_heap_release(TupleTableSlot *slot)
Definition: execTuples.c:321
static bool tts_heap_is_current_xact_tuple(TupleTableSlot *slot)
Definition: execTuples.c:375
struct HeapTupleTableSlot HeapTupleTableSlot

Definition at line 85 of file execTuples.c.

Referenced by CatalogIndexInsert(), CheckOpSlotCompatibility(), compute_expr_stats(), compute_index_stats(), copyTemplateDependencies(), DefineTSConfiguration(), EnumValuesCreate(), ExecInitForeignScan(), ExecInitSetOp(), ExecuteCallStmt(), heapam_index_validate_scan(), init_tuple_slot(), InsertPgAttributeTuples(), make_build_data(), MakeConfigurationMapping(), recordMultipleDependencies(), slot_compile_deform(), table_slot_callbacks(), and tuplesort_begin_cluster().

◆ TTSOpsMinimalTuple

const TupleTableSlotOps TTSOpsMinimalTuple
Initial value:
= {
.base_slot_size = sizeof(MinimalTupleTableSlot),
.release = tts_minimal_release,
.getsomeattrs = tts_minimal_getsomeattrs,
.getsysattr = tts_minimal_getsysattr,
.is_current_xact_tuple = tts_minimal_is_current_xact_tuple,
.materialize = tts_minimal_materialize,
.copyslot = tts_minimal_copyslot,
.get_heap_tuple = NULL,
.get_minimal_tuple = tts_minimal_get_minimal_tuple,
.copy_heap_tuple = tts_minimal_copy_heap_tuple,
.copy_minimal_tuple = tts_minimal_copy_minimal_tuple
}
static HeapTuple tts_minimal_copy_heap_tuple(TupleTableSlot *slot)
Definition: execTuples.c:658
static void tts_minimal_init(TupleTableSlot *slot)
Definition: execTuples.c:508
static MinimalTuple tts_minimal_copy_minimal_tuple(TupleTableSlot *slot)
Definition: execTuples.c:669
static MinimalTuple tts_minimal_get_minimal_tuple(TupleTableSlot *slot)
Definition: execTuples.c:647
static void tts_minimal_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
Definition: execTuples.c:634
static void tts_minimal_release(TupleTableSlot *slot)
Definition: execTuples.c:520
static Datum tts_minimal_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
Definition: execTuples.c:557
static bool tts_minimal_is_current_xact_tuple(TupleTableSlot *slot)
Definition: execTuples.c:574
static void tts_minimal_getsomeattrs(TupleTableSlot *slot, int natts)
Definition: execTuples.c:543
struct MinimalTupleTableSlot MinimalTupleTableSlot

Definition at line 86 of file execTuples.c.

Referenced by afterTriggerInvokeEvents(), build_pertrans_for_aggref(), BuildTupleHashTableExt(), check_publications(), check_publications_origin(), ExecInitAgg(), ExecInitCteScan(), ExecInitFunctionScan(), ExecInitGather(), ExecInitHash(), ExecInitIncrementalSort(), ExecInitMaterial(), ExecInitMemoize(), ExecInitNamedTuplestoreScan(), ExecInitSetOp(), ExecInitSort(), ExecInitSubPlan(), ExecInitTableFuncScan(), ExecInitUnique(), ExecInitWindowAgg(), ExecInitWorkTableScan(), ExecPrepareTuplestoreResult(), fetch_remote_table_info(), fetch_table_list(), find_hash_columns(), gather_merge_setup(), hashagg_recompile_expressions(), hypothetical_dense_rank_final(), init_sql_fcache(), ordered_set_startup(), RunFromStore(), slot_compile_deform(), synchronize_slots(), and validate_remote_info().

◆ TTSOpsVirtual

const TupleTableSlotOps TTSOpsVirtual
Initial value:
= {
.base_slot_size = sizeof(VirtualTupleTableSlot),
.release = tts_virtual_release,
.getsomeattrs = tts_virtual_getsomeattrs,
.getsysattr = tts_virtual_getsysattr,
.materialize = tts_virtual_materialize,
.is_current_xact_tuple = tts_virtual_is_current_xact_tuple,
.copyslot = tts_virtual_copyslot,
.get_heap_tuple = NULL,
.get_minimal_tuple = NULL,
.copy_heap_tuple = tts_virtual_copy_heap_tuple,
.copy_minimal_tuple = tts_virtual_copy_minimal_tuple
}
static HeapTuple tts_virtual_copy_heap_tuple(TupleTableSlot *slot)
Definition: execTuples.c:291
static void tts_virtual_release(TupleTableSlot *slot)
Definition: execTuples.c:103
static void tts_virtual_init(TupleTableSlot *slot)
Definition: execTuples.c:98
static void tts_virtual_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
Definition: execTuples.c:269
static bool tts_virtual_is_current_xact_tuple(TupleTableSlot *slot)
Definition: execTuples.c:157
static void tts_virtual_getsomeattrs(TupleTableSlot *slot, int natts)
Definition: execTuples.c:130
static MinimalTuple tts_virtual_copy_minimal_tuple(TupleTableSlot *slot)
Definition: execTuples.c:301
static Datum tts_virtual_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
Definition: execTuples.c:141
struct VirtualTupleTableSlot VirtualTupleTableSlot

Definition at line 84 of file execTuples.c.

Referenced by apply_handle_delete(), apply_handle_insert(), apply_handle_update(), CheckOpSlotCompatibility(), CreateReplicationSlot(), ExecComputeSlotInfo(), ExecConditionalAssignProjectionInfo(), ExecConstraints(), ExecGetResultSlotOps(), ExecInitAgg(), ExecInitAppend(), ExecInitCustomScan(), ExecInitGroup(), ExecInitHashJoin(), ExecInitIndexOnlyScan(), ExecInitJunkFilter(), ExecInitJunkFilterConversion(), ExecInitMemoize(), ExecInitMergeAppend(), ExecInitMergeJoin(), ExecInitModifyTable(), ExecInitNestLoop(), ExecInitPartitionDispatchInfo(), ExecInitProjectSet(), ExecInitResult(), ExecInitSort(), ExecInitSubPlan(), ExecInitValuesScan(), ExecInitWholeRowVar(), ExecInitWindowAgg(), ExecPartitionCheckEmitError(), ExecWithCheckOptions(), ExplainQuery(), GetAfterTriggersStoreSlot(), IdentifySystem(), InitPlan(), pgoutput_change(), pgoutput_row_filter(), ReadReplicationSlot(), RI_Initial_Check(), RI_PartitionRemove_Check(), SendTablespaceList(), SendXlogRecPtrResult(), ShowAllGUCConfig(), ShowGUCConfigOption(), slot_compile_deform(), StartReplication(), table_slot_callbacks(), and tstoreStartupReceiver().