PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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, Size extra)
 
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, Size extra)
 
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, Size extra)
 
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, Size extra)
 
static pg_attribute_always_inline int slot_deform_heap_tuple_internal (TupleTableSlot *slot, HeapTuple tuple, int attnum, int natts, bool slow, bool hasnulls, uint32 *offp, bool *slowp)
 
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 2444 of file execTuples.c.

2447{
2448 TupOutputState *tstate;
2449
2450 tstate = (TupOutputState *) palloc(sizeof(TupOutputState));
2451
2452 tstate->slot = MakeSingleTupleTableSlot(tupdesc, tts_ops);
2453 tstate->dest = dest;
2454
2455 tstate->dest->rStartup(tstate->dest, (int) CMD_SELECT, tupdesc);
2456
2457 return tstate;
2458}
TupleTableSlot * MakeSingleTupleTableSlot(TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1427
void * palloc(Size size)
Definition: mcxt.c:1317
@ CMD_SELECT
Definition: nodes.h:271
TupleTableSlot * slot
Definition: executor.h:634
DestReceiver * dest
Definition: executor.h:635
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()

TupleDesc BlessTupleDesc ( TupleDesc  tupdesc)

Definition at line 2260 of file execTuples.c.

2261{
2262 if (tupdesc->tdtypeid == RECORDOID &&
2263 tupdesc->tdtypmod < 0)
2265
2266 return tupdesc; /* just for notational convenience */
2267}
int32 tdtypmod
Definition: tupdesc.h:139
Oid tdtypeid
Definition: tupdesc.h:138
void assign_record_type_typmod(TupleDesc tupDesc)
Definition: typcache.c:2042

References assign_record_type_typmod(), TupleDescData::tdtypeid, and TupleDescData::tdtypmod.

Referenced by aclexplode(), brin_metapage_info(), bt_page_items_bytea(), bt_page_items_internal(), exec_eval_datum(), ExecEvalWholeRowVar(), ExecInitExprRec(), ExecInitFunctionScan(), get_expr_result_type(), hash_bitmap_info(), hash_metapage_info(), hash_page_items(), hash_page_stats(), init_execution_state(), InitMaterializedSRF(), injection_points_stats_fixed(), pg_buffercache_numa_pages(), pg_buffercache_pages(), pg_get_catalog_foreign_keys(), pg_get_publication_tables(), pg_get_sequence_data(), pg_lock_status(), pg_prepared_xact(), pg_stat_file(), pg_stat_get_archiver(), pg_stat_get_backend_subxact(), pg_stat_get_replication_slot(), pg_stat_get_subscription_stats(), pg_stat_wal_build_tuple(), pg_stats_ext_mcvlist_items(), pg_visibility_tupdesc(), pg_walfile_name_offset(), pgstathashindex(), PLy_output_setup_record(), setup_firstcall(), ssl_extension_info(), test_enc_conversion(), test_predtest(), and TupleDescGetAttInMetadata().

◆ BuildTupleFromCStrings()

HeapTuple BuildTupleFromCStrings ( AttInMetadata attinmeta,
char **  values 
)

Definition at line 2324 of file execTuples.c.

2325{
2326 TupleDesc tupdesc = attinmeta->tupdesc;
2327 int natts = tupdesc->natts;
2328 Datum *dvalues;
2329 bool *nulls;
2330 int i;
2331 HeapTuple tuple;
2332
2333 dvalues = (Datum *) palloc(natts * sizeof(Datum));
2334 nulls = (bool *) palloc(natts * sizeof(bool));
2335
2336 /*
2337 * Call the "in" function for each non-dropped attribute, even for nulls,
2338 * to support domains.
2339 */
2340 for (i = 0; i < natts; i++)
2341 {
2342 if (!TupleDescCompactAttr(tupdesc, i)->attisdropped)
2343 {
2344 /* Non-dropped attributes */
2345 dvalues[i] = InputFunctionCall(&attinmeta->attinfuncs[i],
2346 values[i],
2347 attinmeta->attioparams[i],
2348 attinmeta->atttypmods[i]);
2349 if (values[i] != NULL)
2350 nulls[i] = false;
2351 else
2352 nulls[i] = true;
2353 }
2354 else
2355 {
2356 /* Handle dropped attributes by setting to NULL */
2357 dvalues[i] = (Datum) 0;
2358 nulls[i] = true;
2359 }
2360 }
2361
2362 /*
2363 * Form a tuple
2364 */
2365 tuple = heap_form_tuple(tupdesc, dvalues, nulls);
2366
2367 /*
2368 * Release locally palloc'd space. XXX would probably be good to pfree
2369 * values of pass-by-reference datums, as well.
2370 */
2371 pfree(dvalues);
2372 pfree(nulls);
2373
2374 return tuple;
2375}
static Datum values[MAXATTR]
Definition: bootstrap.c:151
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:1117
int i
Definition: isn.c:77
void pfree(void *pointer)
Definition: mcxt.c:1524
uintptr_t Datum
Definition: postgres.h:69
FmgrInfo * attinfuncs
Definition: funcapi.h:41
TupleDesc tupdesc
Definition: funcapi.h:38
Oid * attioparams
Definition: funcapi.h:44
int32 * atttypmods
Definition: funcapi.h:47
bool attisdropped
Definition: tupdesc.h:77
static CompactAttribute * TupleDescCompactAttr(TupleDesc tupdesc, int i)
Definition: tupdesc.h:175

References AttInMetadata::attinfuncs, AttInMetadata::attioparams, CompactAttribute::attisdropped, AttInMetadata::atttypmods, heap_form_tuple(), i, InputFunctionCall(), TupleDescData::natts, palloc(), pfree(), AttInMetadata::tupdesc, TupleDescCompactAttr(), 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 2492 of file execTuples.c.

2493{
2494 Datum values[1];
2495 bool isnull[1] = {false};
2496
2497 while (*txt)
2498 {
2499 const char *eol;
2500 int len;
2501
2502 eol = strchr(txt, '\n');
2503 if (eol)
2504 {
2505 len = eol - txt;
2506 eol++;
2507 }
2508 else
2509 {
2510 len = strlen(txt);
2511 eol = txt + len;
2512 }
2513
2515 do_tup_output(tstate, values, isnull);
2517 txt = eol;
2518 }
2519}
void do_tup_output(TupOutputState *tstate, const Datum *values, const bool *isnull)
Definition: execTuples.c:2464
const void size_t len
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:327
static Pointer DatumGetPointer(Datum X)
Definition: postgres.h:317
text * cstring_to_text_with_len(const char *s, int len)
Definition: varlena.c:204

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 2464 of file execTuples.c.

2465{
2466 TupleTableSlot *slot = tstate->slot;
2467 int natts = slot->tts_tupleDescriptor->natts;
2468
2469 /* make sure the slot is clear */
2470 ExecClearTuple(slot);
2471
2472 /* insert data */
2473 memcpy(slot->tts_values, values, natts * sizeof(Datum));
2474 memcpy(slot->tts_isnull, isnull, natts * sizeof(bool));
2475
2476 /* mark slot as containing a virtual tuple */
2478
2479 /* send the tuple to the receiver */
2480 (void) tstate->dest->receiveSlot(slot, tstate->dest);
2481
2482 /* clean up */
2483 ExecClearTuple(slot);
2484}
TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)
Definition: execTuples.c:1741
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:458

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 2522 of file execTuples.c.

2523{
2524 tstate->dest->rShutdown(tstate->dest);
2525 /* note that destroying the dest is not ours to do */
2527 pfree(tstate);
2528}
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
Definition: execTuples.c:1443
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 1360 of file execTuples.c.

1362{
1363 TupleTableSlot *slot = MakeTupleTableSlot(desc, tts_ops);
1364
1365 *tupleTable = lappend(*tupleTable, slot);
1366
1367 return slot;
1368}
TupleTableSlot * MakeTupleTableSlot(TupleDesc tupleDesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1301
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 2139 of file execTuples.c.

2140{
2141 return ExecTypeFromTLInternal(targetList, true);
2142}
static TupleDesc ExecTypeFromTLInternal(List *targetList, bool skipjunk)
Definition: execTuples.c:2145

References ExecTypeFromTLInternal().

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

◆ ExecDropSingleTupleTableSlot()

void ExecDropSingleTupleTableSlot ( TupleTableSlot slot)

Definition at line 1443 of file execTuples.c.

1444{
1445 /* This should match ExecResetTupleTable's processing of one slot */
1446 Assert(IsA(slot, TupleTableSlot));
1447 ExecClearTuple(slot);
1448 slot->tts_ops->release(slot);
1449 if (slot->tts_tupleDescriptor)
1451 if (!TTS_FIXED(slot))
1452 {
1453 if (slot->tts_values)
1454 pfree(slot->tts_values);
1455 if (slot->tts_isnull)
1456 pfree(slot->tts_isnull);
1457 }
1458 pfree(slot);
1459}
Assert(PointerIsAligned(start, uint64))
#define IsA(nodeptr, _type_)
Definition: nodes.h:164
void(* release)(TupleTableSlot *slot)
Definition: tuptable.h:143
const TupleTableSlotOps *const tts_ops
Definition: tuptable.h:121
#define ReleaseTupleDesc(tupdesc)
Definition: tupdesc.h:219
#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(), DoCopyTo(), end_tup_output(), EnumValuesCreate(), ExecCleanupTupleRouting(), ExecEndIncrementalSort(), ExecEndModifyTable(), fetch_remote_table_info(), fetch_table_list(), FindConflictTuple(), 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(), pgoutput_change(), recordMultipleDependencies(), RelationFindReplTupleSeq(), RI_Initial_Check(), RunFromStore(), systable_endscan(), systable_endscan_ordered(), table_index_fetch_tuple_check(), tstoreShutdownReceiver(), validateDomainCheckConstraint(), validateDomainNotNullConstraint(), and validateForeignKeyConstraint().

◆ ExecFetchSlotHeapTuple()

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

Definition at line 1833 of file execTuples.c.

1834{
1835 /*
1836 * sanity checks
1837 */
1838 Assert(slot != NULL);
1839 Assert(!TTS_EMPTY(slot));
1840
1841 /* Materialize the tuple so that the slot "owns" it, if requested. */
1842 if (materialize)
1843 slot->tts_ops->materialize(slot);
1844
1845 if (slot->tts_ops->get_heap_tuple == NULL)
1846 {
1847 if (shouldFree)
1848 *shouldFree = true;
1849 return slot->tts_ops->copy_heap_tuple(slot);
1850 }
1851 else
1852 {
1853 if (shouldFree)
1854 *shouldFree = false;
1855 return slot->tts_ops->get_heap_tuple(slot);
1856 }
1857}
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 1912 of file execTuples.c.

1913{
1914 HeapTuple tup;
1915 TupleDesc tupdesc;
1916 bool shouldFree;
1917 Datum ret;
1918
1919 /* Fetch slot's contents in regular-physical-tuple form */
1920 tup = ExecFetchSlotHeapTuple(slot, false, &shouldFree);
1921 tupdesc = slot->tts_tupleDescriptor;
1922
1923 /* Convert to Datum form */
1924 ret = heap_copy_tuple_as_datum(tup, tupdesc);
1925
1926 if (shouldFree)
1927 pfree(tup);
1928
1929 return ret;
1930}
HeapTuple ExecFetchSlotHeapTuple(TupleTableSlot *slot, bool materialize, bool *shouldFree)
Definition: execTuples.c:1833
Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc)
Definition: heaptuple.c:1081

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 1881 of file execTuples.c.

1883{
1884 /*
1885 * sanity checks
1886 */
1887 Assert(slot != NULL);
1888 Assert(!TTS_EMPTY(slot));
1889
1890 if (slot->tts_ops->get_minimal_tuple)
1891 {
1892 if (shouldFree)
1893 *shouldFree = false;
1894 return slot->tts_ops->get_minimal_tuple(slot);
1895 }
1896 else
1897 {
1898 if (shouldFree)
1899 *shouldFree = true;
1900 return slot->tts_ops->copy_minimal_tuple(slot, 0);
1901 }
1902}
MinimalTuple(* copy_minimal_tuple)(TupleTableSlot *slot, Size extra)
Definition: tuptable.h:226
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 1658 of file execTuples.c.

1661{
1662 if (TTS_IS_HEAPTUPLE(slot))
1663 {
1664 ExecStoreHeapTuple(tuple, slot, shouldFree);
1665 }
1666 else if (TTS_IS_BUFFERTUPLE(slot))
1667 {
1668 MemoryContext oldContext;
1670
1671 ExecClearTuple(slot);
1672 slot->tts_flags &= ~TTS_FLAG_EMPTY;
1673 oldContext = MemoryContextSwitchTo(slot->tts_mcxt);
1674 bslot->base.tuple = heap_copytuple(tuple);
1676 MemoryContextSwitchTo(oldContext);
1677
1678 if (shouldFree)
1679 pfree(tuple);
1680 }
1681 else
1682 {
1683 ExecClearTuple(slot);
1685 slot->tts_values, slot->tts_isnull);
1687
1688 if (shouldFree)
1689 {
1690 ExecMaterializeSlot(slot);
1691 pfree(tuple);
1692 }
1693 }
1694}
TupleTableSlot * ExecStoreHeapTuple(HeapTuple tuple, TupleTableSlot *slot, bool shouldFree)
Definition: execTuples.c:1541
HeapTuple heap_copytuple(HeapTuple tuple)
Definition: heaptuple.c:778
void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)
Definition: heaptuple.c:1346
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:124
MemoryContext tts_mcxt
Definition: tuptable.h:128
uint16 tts_flags
Definition: tuptable.h:118
#define TTS_FLAG_SHOULDFREE
Definition: tuptable.h:99
#define TTS_IS_BUFFERTUPLE(slot)
Definition: tuptable.h:241
static void ExecMaterializeSlot(TupleTableSlot *slot)
Definition: tuptable.h:476
#define TTS_IS_HEAPTUPLE(slot)
Definition: tuptable.h:239

References ExecClearTuple(), ExecMaterializeSlot(), ExecStoreHeapTuple(), ExecStoreVirtualTuple(), heap_copytuple(), heap_deform_tuple(), MemoryContextSwitchTo(), pfree(), 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 1701 of file execTuples.c.

1704{
1705 if (TTS_IS_MINIMALTUPLE(slot))
1706 {
1707 tts_minimal_store_tuple(slot, mtup, shouldFree);
1708 }
1709 else
1710 {
1711 HeapTupleData htup;
1712
1713 ExecClearTuple(slot);
1714
1715 htup.t_len = mtup->t_len + MINIMAL_TUPLE_OFFSET;
1716 htup.t_data = (HeapTupleHeader) ((char *) mtup - MINIMAL_TUPLE_OFFSET);
1718 slot->tts_values, slot->tts_isnull);
1720
1721 if (shouldFree)
1722 {
1723 ExecMaterializeSlot(slot);
1724 pfree(mtup);
1725 }
1726 }
1727}
static void tts_minimal_store_tuple(TupleTableSlot *slot, MinimalTuple mtup, bool shouldFree)
Definition: execTuples.c:682
HeapTupleHeaderData * HeapTupleHeader
Definition: htup.h:23
#define MINIMAL_TUPLE_OFFSET
Definition: htup_details.h:669
uint32 t_len
Definition: htup.h:64
HeapTupleHeader t_data
Definition: htup.h:68
#define TTS_IS_MINIMALTUPLE(slot)
Definition: tuptable.h:240

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

◆ ExecInitNullTupleSlot()

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

Definition at line 2036 of file execTuples.c.

2038{
2039 TupleTableSlot *slot = ExecInitExtraTupleSlot(estate, tupType, tts_ops);
2040
2041 return ExecStoreAllNullTuple(slot);
2042}
TupleTableSlot * ExecInitExtraTupleSlot(EState *estate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:2020
TupleTableSlot * ExecStoreAllNullTuple(TupleTableSlot *slot)
Definition: execTuples.c:1765

References ExecInitExtraTupleSlot(), and ExecStoreAllNullTuple().

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

◆ ExecInitResultSlot()

void ExecInitResultSlot ( PlanState planstate,
const TupleTableSlotOps tts_ops 
)

Definition at line 1968 of file execTuples.c.

1969{
1970 TupleTableSlot *slot;
1971
1972 slot = ExecAllocTableSlot(&planstate->state->es_tupleTable,
1973 planstate->ps_ResultTupleDesc, tts_ops);
1974 planstate->ps_ResultTupleSlot = slot;
1975
1976 planstate->resultopsfixed = planstate->ps_ResultTupleDesc != NULL;
1977 planstate->resultops = tts_ops;
1978 planstate->resultopsset = true;
1979}
const TupleTableSlotOps * resultops
Definition: execnodes.h:1236
bool resultopsset
Definition: execnodes.h:1244
EState * state
Definition: execnodes.h:1161
TupleDesc ps_ResultTupleDesc
Definition: execnodes.h:1196
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1197
bool resultopsfixed
Definition: execnodes.h:1240

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 1380 of file execTuples.c.

1382{
1383 ListCell *lc;
1384
1385 foreach(lc, tupleTable)
1386 {
1388
1389 /* Always release resources and reset the slot to empty */
1390 ExecClearTuple(slot);
1391 slot->tts_ops->release(slot);
1392 if (slot->tts_tupleDescriptor)
1393 {
1395 slot->tts_tupleDescriptor = NULL;
1396 }
1397
1398 /* If shouldFree, release memory occupied by the slot itself */
1399 if (shouldFree)
1400 {
1401 if (!TTS_FIXED(slot))
1402 {
1403 if (slot->tts_values)
1404 pfree(slot->tts_values);
1405 if (slot->tts_isnull)
1406 pfree(slot->tts_isnull);
1407 }
1408 pfree(slot);
1409 }
1410 }
1411
1412 /* If shouldFree, release the list structure */
1413 if (shouldFree)
1414 list_free(tupleTable);
1415}
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 1478 of file execTuples.c.

1480{
1481 Assert(!TTS_FIXED(slot));
1482
1483 /* For safety, make sure slot is empty before changing it */
1484 ExecClearTuple(slot);
1485
1486 /*
1487 * Release any old descriptor. Also release old Datum/isnull arrays if
1488 * present (we don't bother to check if they could be re-used).
1489 */
1490 if (slot->tts_tupleDescriptor)
1492
1493 if (slot->tts_values)
1494 pfree(slot->tts_values);
1495 if (slot->tts_isnull)
1496 pfree(slot->tts_isnull);
1497
1498 /*
1499 * Install the new descriptor; if it's refcounted, bump its refcount.
1500 */
1501 slot->tts_tupleDescriptor = tupdesc;
1502 PinTupleDesc(tupdesc);
1503
1504 /*
1505 * Allocate Datum/isnull arrays of the appropriate size. These must have
1506 * the same lifetime as the slot, so allocate in the slot's own context.
1507 */
1508 slot->tts_values = (Datum *)
1509 MemoryContextAlloc(slot->tts_mcxt, tupdesc->natts * sizeof(Datum));
1510 slot->tts_isnull = (bool *)
1511 MemoryContextAlloc(slot->tts_mcxt, tupdesc->natts * sizeof(bool));
1512}
void * MemoryContextAlloc(MemoryContext context, Size size)
Definition: mcxt.c:1181
#define PinTupleDesc(tupdesc)
Definition: tupdesc.h:213

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 1765 of file execTuples.c.

1766{
1767 /*
1768 * sanity checks
1769 */
1770 Assert(slot != NULL);
1771 Assert(slot->tts_tupleDescriptor != NULL);
1772
1773 /* Clear any old contents */
1774 ExecClearTuple(slot);
1775
1776 /*
1777 * Fill all the columns of the virtual tuple with nulls
1778 */
1779 MemSet(slot->tts_values, 0,
1780 slot->tts_tupleDescriptor->natts * sizeof(Datum));
1781 memset(slot->tts_isnull, true,
1782 slot->tts_tupleDescriptor->natts * sizeof(bool));
1783
1784 return ExecStoreVirtualTuple(slot);
1785}
#define MemSet(start, val, len)
Definition: c.h:991

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

Referenced by ATRewriteTable(), ExecDelete(), ExecGetAllNullSlot(), ExecInitNullTupleSlot(), get_returning_data(), and prepare_projection_slot().

◆ ExecStoreBufferHeapTuple()

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

Definition at line 1581 of file execTuples.c.

1584{
1585 /*
1586 * sanity checks
1587 */
1588 Assert(tuple != NULL);
1589 Assert(slot != NULL);
1590 Assert(slot->tts_tupleDescriptor != NULL);
1591 Assert(BufferIsValid(buffer));
1592
1593 if (unlikely(!TTS_IS_BUFFERTUPLE(slot)))
1594 elog(ERROR, "trying to store an on-disk heap tuple into wrong type of slot");
1595 tts_buffer_heap_store_tuple(slot, tuple, buffer, false);
1596
1597 slot->tts_tableOid = tuple->t_tableOid;
1598
1599 return slot;
1600}
static bool BufferIsValid(Buffer bufnum)
Definition: bufmgr.h:358
#define unlikely(x)
Definition: c.h:347
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:226
static void tts_buffer_heap_store_tuple(TupleTableSlot *slot, HeapTuple tuple, Buffer buffer, bool transfer_pin)
Definition: execTuples.c:944
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 1541 of file execTuples.c.

1544{
1545 /*
1546 * sanity checks
1547 */
1548 Assert(tuple != NULL);
1549 Assert(slot != NULL);
1550 Assert(slot->tts_tupleDescriptor != NULL);
1551
1552 if (unlikely(!TTS_IS_HEAPTUPLE(slot)))
1553 elog(ERROR, "trying to store a heap tuple into wrong type of slot");
1554 tts_heap_store_tuple(slot, tuple, shouldFree);
1555
1556 slot->tts_tableOid = tuple->t_tableOid;
1557
1558 return slot;
1559}
static void tts_heap_store_tuple(TupleTableSlot *slot, HeapTuple tuple, bool shouldFree)
Definition: execTuples.c:487

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(), and tts_heap_copyslot().

◆ ExecStoreHeapTupleDatum()

void ExecStoreHeapTupleDatum ( Datum  data,
TupleTableSlot slot 
)

Definition at line 1795 of file execTuples.c.

1796{
1797 HeapTupleData tuple = {0};
1798 HeapTupleHeader td;
1799
1801
1803 tuple.t_self = td->t_ctid;
1804 tuple.t_data = td;
1805
1806 ExecClearTuple(slot);
1807
1809 slot->tts_values, slot->tts_isnull);
1811}
#define DatumGetHeapTupleHeader(X)
Definition: fmgr.h:295
static uint32 HeapTupleHeaderGetDatumLength(const HeapTupleHeaderData *tup)
Definition: htup_details.h:492
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()

◆ ExecStorePinnedBufferHeapTuple()

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

Definition at line 1607 of file execTuples.c.

1610{
1611 /*
1612 * sanity checks
1613 */
1614 Assert(tuple != NULL);
1615 Assert(slot != NULL);
1616 Assert(slot->tts_tupleDescriptor != NULL);
1617 Assert(BufferIsValid(buffer));
1618
1619 if (unlikely(!TTS_IS_BUFFERTUPLE(slot)))
1620 elog(ERROR, "trying to store an on-disk heap tuple into wrong type of slot");
1621 tts_buffer_heap_store_tuple(slot, tuple, buffer, true);
1622
1623 slot->tts_tableOid = tuple->t_tableOid;
1624
1625 return slot;
1626}

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)

◆ ExecTypeFromExprList()

TupleDesc ExecTypeFromExprList ( List exprList)

Definition at line 2186 of file execTuples.c.

2187{
2188 TupleDesc typeInfo;
2189 ListCell *lc;
2190 int cur_resno = 1;
2191
2192 typeInfo = CreateTemplateTupleDesc(list_length(exprList));
2193
2194 foreach(lc, exprList)
2195 {
2196 Node *e = lfirst(lc);
2197
2198 TupleDescInitEntry(typeInfo,
2199 cur_resno,
2200 NULL,
2201 exprType(e),
2202 exprTypmod(e),
2203 0);
2205 cur_resno,
2206 exprCollation(e));
2207 cur_resno++;
2208 }
2209
2210 return typeInfo;
2211}
Oid exprType(const Node *expr)
Definition: nodeFuncs.c:42
int32 exprTypmod(const Node *expr)
Definition: nodeFuncs.c:301
Oid exprCollation(const Node *expr)
Definition: nodeFuncs.c:821
#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:135
TupleDesc CreateTemplateTupleDesc(int natts)
Definition: tupdesc.c:175
void TupleDescInitEntryCollation(TupleDesc desc, AttrNumber attributeNumber, Oid collationid)
Definition: tupdesc.c:1019
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
Definition: tupdesc.c:835

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

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

◆ ExecTypeFromTL()

◆ ExecTypeFromTLInternal()

static TupleDesc ExecTypeFromTLInternal ( List targetList,
bool  skipjunk 
)
static

Definition at line 2145 of file execTuples.c.

2146{
2147 TupleDesc typeInfo;
2148 ListCell *l;
2149 int len;
2150 int cur_resno = 1;
2151
2152 if (skipjunk)
2153 len = ExecCleanTargetListLength(targetList);
2154 else
2155 len = ExecTargetListLength(targetList);
2156 typeInfo = CreateTemplateTupleDesc(len);
2157
2158 foreach(l, targetList)
2159 {
2160 TargetEntry *tle = lfirst(l);
2161
2162 if (skipjunk && tle->resjunk)
2163 continue;
2164 TupleDescInitEntry(typeInfo,
2165 cur_resno,
2166 tle->resname,
2167 exprType((Node *) tle->expr),
2168 exprTypmod((Node *) tle->expr),
2169 0);
2171 cur_resno,
2172 exprCollation((Node *) tle->expr));
2173 cur_resno++;
2174 }
2175
2176 return typeInfo;
2177}
int ExecTargetListLength(List *targetlist)
Definition: execUtils.c:1176
int ExecCleanTargetListLength(List *targetlist)
Definition: execUtils.c:1186
Expr * expr
Definition: primnodes.h:2219

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 2219 of file execTuples.c.

2220{
2221 int colno = 0;
2222 ListCell *lc;
2223
2224 /* It's only OK to change col names in a not-yet-blessed RECORD type */
2225 Assert(typeInfo->tdtypeid == RECORDOID);
2226 Assert(typeInfo->tdtypmod < 0);
2227
2228 foreach(lc, namesList)
2229 {
2230 char *cname = strVal(lfirst(lc));
2231 Form_pg_attribute attr;
2232
2233 /* Guard against too-long names list (probably can't happen) */
2234 if (colno >= typeInfo->natts)
2235 break;
2236 attr = TupleDescAttr(typeInfo, colno);
2237 colno++;
2238
2239 /*
2240 * Do nothing for empty aliases or dropped columns (these cases
2241 * probably can't arise in RECORD types, either)
2242 */
2243 if (cname[0] == '\0' || attr->attisdropped)
2244 continue;
2245
2246 /* OK, assign the column name */
2247 namestrcpy(&(attr->attname), cname);
2248 }
2249}
void namestrcpy(Name name, const char *str)
Definition: name.c:233
FormData_pg_attribute * Form_pg_attribute
Definition: pg_attribute.h:202
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
Definition: tupdesc.h:160
#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 2413 of file execTuples.c.

2414{
2415 Datum result;
2416 TupleDesc tupDesc;
2417
2418 /* No work if there are no external TOAST pointers in the tuple */
2419 if (!HeapTupleHeaderHasExternal(tuple))
2420 return PointerGetDatum(tuple);
2421
2422 /* Use the type data saved by heap_form_tuple to look up the rowtype */
2425
2426 /* And do the flattening */
2427 result = toast_flatten_tuple_to_datum(tuple,
2429 tupDesc);
2430
2431 ReleaseTupleDesc(tupDesc);
2432
2433 return result;
2434}
Datum toast_flatten_tuple_to_datum(HeapTupleHeader tup, uint32 tup_len, TupleDesc tupleDesc)
Definition: heaptoast.c:449
static int32 HeapTupleHeaderGetTypMod(const HeapTupleHeaderData *tup)
Definition: htup_details.h:516
#define HeapTupleHeaderHasExternal(tup)
Definition: htup_details.h:585
static Oid HeapTupleHeaderGetTypeId(const HeapTupleHeaderData *tup)
Definition: htup_details.h:504
TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod)
Definition: typcache.c:1922

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 1301 of file execTuples.c.

1303{
1304 Size basesz,
1305 allocsz;
1306 TupleTableSlot *slot;
1307
1308 basesz = tts_ops->base_slot_size;
1309
1310 /*
1311 * When a fixed descriptor is specified, we can reduce overhead by
1312 * allocating the entire slot in one go.
1313 */
1314 if (tupleDesc)
1315 allocsz = MAXALIGN(basesz) +
1316 MAXALIGN(tupleDesc->natts * sizeof(Datum)) +
1317 MAXALIGN(tupleDesc->natts * sizeof(bool));
1318 else
1319 allocsz = basesz;
1320
1321 slot = palloc0(allocsz);
1322 /* const for optimization purposes, OK to modify at allocation time */
1323 *((const TupleTableSlotOps **) &slot->tts_ops) = tts_ops;
1324 slot->type = T_TupleTableSlot;
1325 slot->tts_flags |= TTS_FLAG_EMPTY;
1326 if (tupleDesc != NULL)
1327 slot->tts_flags |= TTS_FLAG_FIXED;
1328 slot->tts_tupleDescriptor = tupleDesc;
1330 slot->tts_nvalid = 0;
1331
1332 if (tupleDesc != NULL)
1333 {
1334 slot->tts_values = (Datum *)
1335 (((char *) slot)
1336 + MAXALIGN(basesz));
1337 slot->tts_isnull = (bool *)
1338 (((char *) slot)
1339 + MAXALIGN(basesz)
1340 + MAXALIGN(tupleDesc->natts * sizeof(Datum)));
1341
1342 PinTupleDesc(tupleDesc);
1343 }
1344
1345 /*
1346 * And allow slot type specific initialization.
1347 */
1348 slot->tts_ops->init(slot);
1349
1350 return slot;
1351}
#define MAXALIGN(LEN)
Definition: c.h:782
size_t Size
Definition: c.h:576
void * palloc0(Size size)
Definition: mcxt.c:1347
MemoryContext CurrentMemoryContext
Definition: mcxt.c:143
size_t base_slot_size
Definition: tuptable.h:137
void(* init)(TupleTableSlot *slot)
Definition: tuptable.h:140
NodeTag type
Definition: tuptable.h:116
#define TTS_FLAG_EMPTY
Definition: tuptable.h:95
#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(), pgoutput_change(), and ReportNotNullViolationError().

◆ 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 1122 of file execTuples.c.

1124{
1125 bool hasnulls = HeapTupleHasNulls(tuple);
1126 int attnum;
1127 uint32 off; /* offset in tuple data */
1128 bool slow; /* can we use/set attcacheoff? */
1129
1130 /* We can only fetch as many attributes as the tuple has. */
1131 natts = Min(HeapTupleHeaderGetNatts(tuple->t_data), natts);
1132
1133 /*
1134 * Check whether the first call for this tuple, and initialize or restore
1135 * loop state.
1136 */
1137 attnum = slot->tts_nvalid;
1138 if (attnum == 0)
1139 {
1140 /* Start from the first attribute */
1141 off = 0;
1142 slow = false;
1143 }
1144 else
1145 {
1146 /* Restore state from previous execution */
1147 off = *offp;
1148 slow = TTS_SLOW(slot);
1149 }
1150
1151 /*
1152 * If 'slow' isn't set, try deforming using deforming code that does not
1153 * contain any of the extra checks required for non-fixed offset
1154 * deforming. During deforming, if or when we find a NULL or a variable
1155 * length attribute, we'll switch to a deforming method which includes the
1156 * extra code required for non-fixed offset deforming, a.k.a slow mode.
1157 * Because this is performance critical, we inline
1158 * slot_deform_heap_tuple_internal passing the 'slow' and 'hasnull'
1159 * parameters as constants to allow the compiler to emit specialized code
1160 * with the known-const false comparisons and subsequent branches removed.
1161 */
1162 if (!slow)
1163 {
1164 /* Tuple without any NULLs? We can skip doing any NULL checking */
1165 if (!hasnulls)
1167 tuple,
1168 attnum,
1169 natts,
1170 false, /* slow */
1171 false, /* hasnulls */
1172 &off,
1173 &slow);
1174 else
1176 tuple,
1177 attnum,
1178 natts,
1179 false, /* slow */
1180 true, /* hasnulls */
1181 &off,
1182 &slow);
1183 }
1184
1185 /* If there's still work to do then we must be in slow mode */
1186 if (attnum < natts)
1187 {
1188 /* XXX is it worth adding a separate call when hasnulls is false? */
1190 tuple,
1191 attnum,
1192 natts,
1193 true, /* slow */
1194 hasnulls,
1195 &off,
1196 &slow);
1197 }
1198
1199 /*
1200 * Save state for next execution
1201 */
1202 slot->tts_nvalid = attnum;
1203 *offp = off;
1204 if (slow)
1205 slot->tts_flags |= TTS_FLAG_SLOW;
1206 else
1207 slot->tts_flags &= ~TTS_FLAG_SLOW;
1208}
#define Min(x, y)
Definition: c.h:975
uint32_t uint32
Definition: c.h:502
static pg_attribute_always_inline int slot_deform_heap_tuple_internal(TupleTableSlot *slot, HeapTuple tuple, int attnum, int natts, bool slow, bool hasnulls, uint32 *offp, bool *slowp)
Definition: execTuples.c:1019
#define HeapTupleHeaderGetNatts(tup)
Definition: htup_details.h:577
static bool HeapTupleHasNulls(const HeapTupleData *tuple)
Definition: htup_details.h:738
int16 attnum
Definition: pg_attribute.h:74
#define TTS_FLAG_SLOW
Definition: tuptable.h:103
#define TTS_SLOW(slot)
Definition: tuptable.h:104

References attnum, HeapTupleHasNulls(), HeapTupleHeaderGetNatts, Min, slot_deform_heap_tuple_internal(), HeapTupleData::t_data, TTS_FLAG_SLOW, TupleTableSlot::tts_flags, TupleTableSlot::tts_nvalid, and TTS_SLOW.

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

◆ slot_deform_heap_tuple_internal()

static pg_attribute_always_inline int slot_deform_heap_tuple_internal ( TupleTableSlot slot,
HeapTuple  tuple,
int  attnum,
int  natts,
bool  slow,
bool  hasnulls,
uint32 offp,
bool *  slowp 
)
static

Definition at line 1019 of file execTuples.c.

1022{
1023 TupleDesc tupleDesc = slot->tts_tupleDescriptor;
1024 Datum *values = slot->tts_values;
1025 bool *isnull = slot->tts_isnull;
1026 HeapTupleHeader tup = tuple->t_data;
1027 char *tp; /* ptr to tuple data */
1028 bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */
1029 bool slownext = false;
1030
1031 tp = (char *) tup + tup->t_hoff;
1032
1033 for (; attnum < natts; attnum++)
1034 {
1035 CompactAttribute *thisatt = TupleDescCompactAttr(tupleDesc, attnum);
1036
1037 if (hasnulls && att_isnull(attnum, bp))
1038 {
1039 values[attnum] = (Datum) 0;
1040 isnull[attnum] = true;
1041 if (!slow)
1042 {
1043 *slowp = true;
1044 return attnum + 1;
1045 }
1046 else
1047 continue;
1048 }
1049
1050 isnull[attnum] = false;
1051
1052 /* calculate the offset of this attribute */
1053 if (!slow && thisatt->attcacheoff >= 0)
1054 *offp = thisatt->attcacheoff;
1055 else if (thisatt->attlen == -1)
1056 {
1057 /*
1058 * We can only cache the offset for a varlena attribute if the
1059 * offset is already suitably aligned, so that there would be no
1060 * pad bytes in any case: then the offset will be valid for either
1061 * an aligned or unaligned value.
1062 */
1063 if (!slow && *offp == att_nominal_alignby(*offp, thisatt->attalignby))
1064 thisatt->attcacheoff = *offp;
1065 else
1066 {
1067 *offp = att_pointer_alignby(*offp,
1068 thisatt->attalignby,
1069 -1,
1070 tp + *offp);
1071
1072 if (!slow)
1073 slownext = true;
1074 }
1075 }
1076 else
1077 {
1078 /* not varlena, so safe to use att_nominal_alignby */
1079 *offp = att_nominal_alignby(*offp, thisatt->attalignby);
1080
1081 if (!slow)
1082 thisatt->attcacheoff = *offp;
1083 }
1084
1085 values[attnum] = fetchatt(thisatt, tp + *offp);
1086
1087 *offp = att_addlength_pointer(*offp, thisatt->attlen, tp + *offp);
1088
1089 /* check if we need to switch to slow mode */
1090 if (!slow)
1091 {
1092 /*
1093 * We're unable to deform any further if the above code set
1094 * 'slownext', or if this isn't a fixed-width attribute.
1095 */
1096 if (slownext || thisatt->attlen <= 0)
1097 {
1098 *slowp = true;
1099 return attnum + 1;
1100 }
1101 }
1102 }
1103
1104 return natts;
1105}
uint8 bits8
Definition: c.h:509
for(;;)
uint8 attalignby
Definition: tupdesc.h:80
int16 attlen
Definition: tupdesc.h:71
int32 attcacheoff
Definition: tupdesc.h:70
bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]
Definition: htup_details.h:178
#define att_nominal_alignby(cur_offset, attalignby)
Definition: tupmacs.h:165
static bool att_isnull(int ATT, const bits8 *BITS)
Definition: tupmacs.h:26
#define att_addlength_pointer(cur_offset, attlen, attptr)
Definition: tupmacs.h:185
#define att_pointer_alignby(cur_offset, attalignby, attlen, attptr)
Definition: tupmacs.h:129
#define fetchatt(A, T)
Definition: tupmacs.h:47

References att_addlength_pointer, att_isnull(), att_nominal_alignby, att_pointer_alignby, CompactAttribute::attalignby, CompactAttribute::attcacheoff, CompactAttribute::attlen, attnum, fetchatt, for(), HeapTupleHeaderData::t_bits, HeapTupleData::t_data, HeapTupleHeaderData::t_hoff, TupleTableSlot::tts_isnull, TupleTableSlot::tts_tupleDescriptor, TupleTableSlot::tts_values, TupleDescCompactAttr(), and values.

Referenced by slot_deform_heap_tuple().

◆ slot_getmissingattrs()

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

Definition at line 2057 of file execTuples.c.

2058{
2059 AttrMissing *attrmiss = NULL;
2060
2061 if (slot->tts_tupleDescriptor->constr)
2062 attrmiss = slot->tts_tupleDescriptor->constr->missing;
2063
2064 if (!attrmiss)
2065 {
2066 /* no missing values array at all, so just fill everything in as NULL */
2067 memset(slot->tts_values + startAttNum, 0,
2068 (lastAttNum - startAttNum) * sizeof(Datum));
2069 memset(slot->tts_isnull + startAttNum, 1,
2070 (lastAttNum - startAttNum) * sizeof(bool));
2071 }
2072 else
2073 {
2074 int missattnum;
2075
2076 /* if there is a missing values array we must process them one by one */
2077 for (missattnum = startAttNum;
2078 missattnum < lastAttNum;
2079 missattnum++)
2080 {
2081 slot->tts_values[missattnum] = attrmiss[missattnum].am_value;
2082 slot->tts_isnull[missattnum] = !attrmiss[missattnum].am_present;
2083 }
2084 }
2085}
struct AttrMissing * missing
Definition: tupdesc.h:42
TupleConstr * constr
Definition: tupdesc.h:141

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 2091 of file execTuples.c.

2092{
2093 /* Check for caller errors */
2094 Assert(slot->tts_nvalid < attnum); /* checked in slot_getsomeattrs */
2095 Assert(attnum > 0);
2096
2098 elog(ERROR, "invalid attribute number %d", attnum);
2099
2100 /* Fetch as many attributes as possible from the underlying tuple. */
2101 slot->tts_ops->getsomeattrs(slot, attnum);
2102
2103 /*
2104 * If the underlying tuple doesn't have enough attributes, tuple
2105 * descriptor must have the missing attributes.
2106 */
2107 if (unlikely(slot->tts_nvalid < attnum))
2108 {
2110 slot->tts_nvalid = attnum;
2111 }
2112}
void slot_getmissingattrs(TupleTableSlot *slot, int startAttNum, int lastAttNum)
Definition: execTuples.c:2057
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 721 of file execTuples.c.

722{
724
725 /*
726 * Free the memory for heap tuple if allowed. A tuple coming from buffer
727 * can never be freed. But we may have materialized a tuple from buffer.
728 * Such a tuple can be freed.
729 */
730 if (TTS_SHOULDFREE(slot))
731 {
732 /* We should have unpinned the buffer while materializing the tuple. */
733 Assert(!BufferIsValid(bslot->buffer));
734
735 heap_freetuple(bslot->base.tuple);
736 slot->tts_flags &= ~TTS_FLAG_SHOULDFREE;
737 }
738
739 if (BufferIsValid(bslot->buffer))
740 ReleaseBuffer(bslot->buffer);
741
742 slot->tts_nvalid = 0;
743 slot->tts_flags |= TTS_FLAG_EMPTY;
745 bslot->base.tuple = NULL;
746 bslot->base.off = 0;
747 bslot->buffer = InvalidBuffer;
748}
#define InvalidBuffer
Definition: buf.h:25
void ReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:5303
void heap_freetuple(HeapTuple htup)
Definition: heaptuple.c:1435
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, 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 918 of file execTuples.c.

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

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,
Size  extra 
)
static

Definition at line 931 of file execTuples.c.

932{
934
935 Assert(!TTS_EMPTY(slot));
936
937 if (!bslot->base.tuple)
939
940 return minimal_tuple_from_heap_tuple(bslot->base.tuple, extra);
941}
MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup, Size extra)
Definition: heaptuple.c:1587

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 863 of file execTuples.c.

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

References Assert(), BufferHeapTupleTableSlot::buffer, BufferIsValid(), ExecClearTuple(), ExecCopySlotHeapTuple(), MemoryContextSwitchTo(), tts_buffer_heap_store_tuple(), 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 905 of file execTuples.c.

906{
908
909 Assert(!TTS_EMPTY(slot));
910
911 if (!bslot->base.tuple)
913
914 return bslot->base.tuple;
915}

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 751 of file execTuples.c.

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

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 761 of file execTuples.c.

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

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 711 of file execTuples.c.

712{
713}

◆ tts_buffer_heap_materialize()

static void tts_buffer_heap_materialize ( TupleTableSlot slot)
static

Definition at line 804 of file execTuples.c.

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

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 716 of file execTuples.c.

717{
718}

◆ 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 944 of file execTuples.c.

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

References Assert(), BufferHeapTupleTableSlot::buffer, BufferIsValid(), heap_freetuple(), IncrBufferRefCount(), ReleaseBuffer(), HeapTupleData::t_self, 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 781 of file execTuples.c.

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

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 327 of file execTuples.c.

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

References heap_freetuple(), ItemPointerSetInvalid(), HeapTupleTableSlot::off, TTS_FLAG_EMPTY, 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 464 of file execTuples.c.

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

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,
Size  extra 
)
static

Definition at line 476 of file execTuples.c.

477{
478 HeapTupleTableSlot *hslot = (HeapTupleTableSlot *) slot;
479
480 if (!hslot->tuple)
482
483 return minimal_tuple_from_heap_tuple(hslot->tuple, extra);
484}

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 439 of file execTuples.c.

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

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 452 of file execTuples.c.

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

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 346 of file execTuples.c.

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

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 356 of file execTuples.c.

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

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 317 of file execTuples.c.

318{
319}

◆ tts_heap_is_current_xact_tuple()

static bool tts_heap_is_current_xact_tuple ( TupleTableSlot slot)
static

Definition at line 376 of file execTuples.c.

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

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 399 of file execTuples.c.

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

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 322 of file execTuples.c.

323{
324}

◆ tts_heap_store_tuple()

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

Definition at line 487 of file execTuples.c.

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

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 526 of file execTuples.c.

527{
529
530 if (TTS_SHOULDFREE(slot))
531 {
533 slot->tts_flags &= ~TTS_FLAG_SHOULDFREE;
534 }
535
536 slot->tts_nvalid = 0;
537 slot->tts_flags |= TTS_FLAG_EMPTY;
539 mslot->off = 0;
540 mslot->mintuple = NULL;
541}
void heap_free_minimal_tuple(MinimalTuple mtup)
Definition: heaptuple.c:1530
MinimalTuple mintuple
Definition: tuptable.h:301

References heap_free_minimal_tuple(), ItemPointerSetInvalid(), MinimalTupleTableSlot::mintuple, MinimalTupleTableSlot::off, TTS_FLAG_EMPTY, 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 660 of file execTuples.c.

661{
663
664 if (!mslot->mintuple)
666
668}
static void tts_minimal_materialize(TupleTableSlot *slot)
Definition: execTuples.c:587
HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup)
Definition: heaptuple.c:1565

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,
Size  extra 
)
static

Definition at line 671 of file execTuples.c.

672{
674
675 if (!mslot->mintuple)
677
678 return heap_copy_minimal_tuple(mslot->mintuple, extra);
679}
MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup, Size extra)
Definition: heaptuple.c:1542

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 636 of file execTuples.c.

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

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 649 of file execTuples.c.

650{
652
653 if (!mslot->mintuple)
655
656 return mslot->mintuple;
657}

References MinimalTupleTableSlot::mintuple, and tts_minimal_materialize().

◆ tts_minimal_getsomeattrs()

static void tts_minimal_getsomeattrs ( TupleTableSlot slot,
int  natts 
)
static

Definition at line 544 of file execTuples.c.

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

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 558 of file execTuples.c.

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

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

◆ tts_minimal_init()

static void tts_minimal_init ( TupleTableSlot slot)
static

Definition at line 509 of file execTuples.c.

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

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 575 of file execTuples.c.

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

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

◆ tts_minimal_materialize()

static void tts_minimal_materialize ( TupleTableSlot slot)
static

Definition at line 587 of file execTuples.c.

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

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 521 of file execTuples.c.

522{
523}

◆ tts_minimal_store_tuple()

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

Definition at line 682 of file execTuples.c.

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

References Assert(), 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, 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, 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

◆ tts_virtual_copy_minimal_tuple()

static MinimalTuple tts_virtual_copy_minimal_tuple ( TupleTableSlot slot,
Size  extra 
)
static

◆ 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 */
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:372

References TupleDescData::natts, slot_getallattrs(), 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
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
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 CompactAttribute *att = TupleDescCompactAttr(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_nominal_alignby(sz, att->attalignby);
207 }
208 else
209 {
210 sz = att_nominal_alignby(sz, att->attalignby);
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 CompactAttribute *att = TupleDescCompactAttr(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_nominal_alignby(data,
246 att->attalignby);
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_nominal_alignby(data, att->attalignby);
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:689
#define att_addlength_datum(cur_offset, attlen, attdatum)
Definition: tupmacs.h:173
#define VARATT_IS_EXTERNAL_EXPANDED(PTR)
Definition: varatt.h:298

References att_addlength_datum, att_nominal_alignby, CompactAttribute::attalignby, CompactAttribute::attbyval, CompactAttribute::attlen, 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, TupleDescCompactAttr(), 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 2275 of file execTuples.c.

2276{
2277 int natts = tupdesc->natts;
2278 int i;
2279 Oid atttypeid;
2280 Oid attinfuncid;
2281 FmgrInfo *attinfuncinfo;
2282 Oid *attioparams;
2283 int32 *atttypmods;
2284 AttInMetadata *attinmeta;
2285
2286 attinmeta = (AttInMetadata *) palloc(sizeof(AttInMetadata));
2287
2288 /* "Bless" the tupledesc so that we can make rowtype datums with it */
2289 attinmeta->tupdesc = BlessTupleDesc(tupdesc);
2290
2291 /*
2292 * Gather info needed later to call the "in" function for each attribute
2293 */
2294 attinfuncinfo = (FmgrInfo *) palloc0(natts * sizeof(FmgrInfo));
2295 attioparams = (Oid *) palloc0(natts * sizeof(Oid));
2296 atttypmods = (int32 *) palloc0(natts * sizeof(int32));
2297
2298 for (i = 0; i < natts; i++)
2299 {
2300 Form_pg_attribute att = TupleDescAttr(tupdesc, i);
2301
2302 /* Ignore dropped attributes */
2303 if (!att->attisdropped)
2304 {
2305 atttypeid = att->atttypid;
2306 getTypeInputInfo(atttypeid, &attinfuncid, &attioparams[i]);
2307 fmgr_info(attinfuncid, &attinfuncinfo[i]);
2308 atttypmods[i] = att->atttypmod;
2309 }
2310 }
2311 attinmeta->attinfuncs = attinfuncinfo;
2312 attinmeta->attioparams = attioparams;
2313 attinmeta->atttypmods = atttypmods;
2314
2315 return attinmeta;
2316}
int32_t int32
Definition: c.h:498
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
Definition: execTuples.c:2260
void fmgr_info(Oid functionId, FmgrInfo *finfo)
Definition: fmgr.c:127
void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam)
Definition: lsyscache.c:3014
unsigned int Oid
Definition: postgres_ext.h:30
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:863
static HeapTuple tts_buffer_heap_copy_heap_tuple(TupleTableSlot *slot)
Definition: execTuples.c:918
static void tts_buffer_heap_clear(TupleTableSlot *slot)
Definition: execTuples.c:721
static Datum tts_buffer_heap_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
Definition: execTuples.c:761
static bool tts_buffer_is_current_xact_tuple(TupleTableSlot *slot)
Definition: execTuples.c:781
static HeapTuple tts_buffer_heap_get_heap_tuple(TupleTableSlot *slot)
Definition: execTuples.c:905
static void tts_buffer_heap_release(TupleTableSlot *slot)
Definition: execTuples.c:716
static MinimalTuple tts_buffer_heap_copy_minimal_tuple(TupleTableSlot *slot, Size extra)
Definition: execTuples.c:931
static void tts_buffer_heap_getsomeattrs(TupleTableSlot *slot, int natts)
Definition: execTuples.c:751
static void tts_buffer_heap_init(TupleTableSlot *slot)
Definition: execTuples.c:711
int init
Definition: isn.c:79
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:356
static void tts_heap_init(TupleTableSlot *slot)
Definition: execTuples.c:317
static HeapTuple tts_heap_copy_heap_tuple(TupleTableSlot *slot)
Definition: execTuples.c:464
static MinimalTuple tts_heap_copy_minimal_tuple(TupleTableSlot *slot, Size extra)
Definition: execTuples.c:476
static HeapTuple tts_heap_get_heap_tuple(TupleTableSlot *slot)
Definition: execTuples.c:452
static void tts_heap_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
Definition: execTuples.c:439
static void tts_heap_getsomeattrs(TupleTableSlot *slot, int natts)
Definition: execTuples.c:346
static void tts_heap_release(TupleTableSlot *slot)
Definition: execTuples.c:322
static bool tts_heap_is_current_xact_tuple(TupleTableSlot *slot)
Definition: execTuples.c:376
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(), 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:660
static void tts_minimal_init(TupleTableSlot *slot)
Definition: execTuples.c:509
static MinimalTuple tts_minimal_get_minimal_tuple(TupleTableSlot *slot)
Definition: execTuples.c:649
static void tts_minimal_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
Definition: execTuples.c:636
static void tts_minimal_release(TupleTableSlot *slot)
Definition: execTuples.c:521
static Datum tts_minimal_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
Definition: execTuples.c:558
static bool tts_minimal_is_current_xact_tuple(TupleTableSlot *slot)
Definition: execTuples.c:575
static MinimalTuple tts_minimal_copy_minimal_tuple(TupleTableSlot *slot, Size extra)
Definition: execTuples.c:671
static void tts_minimal_getsomeattrs(TupleTableSlot *slot, int natts)
Definition: execTuples.c:544
struct MinimalTupleTableSlot MinimalTupleTableSlot

Definition at line 86 of file execTuples.c.

Referenced by afterTriggerInvokeEvents(), build_pertrans_for_aggref(), BuildTupleHashTable(), 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_execution_state(), 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 MinimalTuple tts_virtual_copy_minimal_tuple(TupleTableSlot *slot, Size extra)
Definition: execTuples.c:301
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 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(), buildSubPlanHash(), 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(), ReportNotNullViolationError(), RI_Initial_Check(), RI_PartitionRemove_Check(), SendTablespaceList(), SendXlogRecPtrResult(), ShowAllGUCConfig(), ShowGUCConfigOption(), slot_compile_deform(), StartReplication(), table_slot_callbacks(), and tstoreStartupReceiver().