132 elog(
ERROR,
"getsomeattrs is not required to be called on a virtual tuple table slot");
138 elog(
ERROR,
"virtual tuple table slot does not have system attributes");
163 for (
int natt = 0; natt < desc->
natts; natt++)
173 if (att->attlen == -1 &&
199 for (
int natt = 0; natt < desc->
natts; natt++)
209 if (att->attlen == -1 &&
230 Size data_length = 0;
254 for (
int natt = 0; natt < srcdesc->
natts; natt++)
438 hslot->
tuple = tuple;
500 elog(
ERROR,
"minimal tuple table slot does not have system attributes");
830 Buffer buffer,
bool transfer_pin)
860 if (bslot->
buffer != buffer)
930 tp = (
char *) tup + tup->
t_hoff;
932 for (; attnum < natts; attnum++)
946 if (!slow && thisatt->attcacheoff >= 0)
947 off = thisatt->attcacheoff;
948 else if (thisatt->attlen == -1)
958 thisatt->attcacheoff = off;
972 thisatt->attcacheoff = off;
979 if (thisatt->attlen <= 0)
986 slot->tts_nvalid =
attnum;
1009 .get_heap_tuple = NULL,
1010 .get_minimal_tuple = NULL,
1027 .get_minimal_tuple = NULL,
1043 .get_heap_tuple = NULL,
1061 .get_minimal_tuple = NULL,
1107 if (tupleDesc != NULL)
1113 if (tupleDesc != NULL)
1146 *tupleTable =
lappend(*tupleTable, slot);
1166 foreach(lc, tupleTable)
1334 elog(
ERROR,
"trying to store a heap tuple into wrong type of slot");
1375 elog(
ERROR,
"trying to store an on-disk heap tuple into wrong type of slot");
1401 elog(
ERROR,
"trying to store an on-disk heap tuple into wrong type of slot");
1428 elog(
ERROR,
"trying to store a minimal tuple into wrong type of slot");
1635 *shouldFree =
false;
1674 *shouldFree =
false;
1785 tupledesc, tts_ops);
1849 (lastAttNum - startAttNum) *
sizeof(
Datum));
1851 (lastAttNum - startAttNum) *
sizeof(
bool));
1858 for (missattnum = startAttNum;
1859 missattnum < lastAttNum;
1879 elog(
ERROR,
"invalid attribute number %d", attnum);
1939 foreach(l, targetList)
1975 foreach(lc, exprList)
2008 bool modified =
false;
2012 foreach(lc, namesList)
2018 if (colno >= typeInfo->
natts)
2024 if (cname[0] ==
'\0')
2028 if (strcmp(cname,
NameStr(attr->attname)) != 0)
2054 if (tupdesc->
tdtypeid == RECORDOID &&
2069 int natts = tupdesc->
natts;
2090 for (i = 0; i < natts; i++)
2095 if (!att->attisdropped)
2097 atttypeid = att->atttypid;
2099 fmgr_info(attinfuncid, &attinfuncinfo[i]);
2100 atttypmods[
i] = att->atttypmod;
2119 int natts = tupdesc->
natts;
2126 nulls = (
bool *)
palloc(natts *
sizeof(
bool));
2132 for (i = 0; i < natts; i++)
2141 if (values[i] != NULL)
2266 memcpy(slot->
tts_isnull, isnull, natts *
sizeof(
bool));
2287 bool isnull[1] = {
false};
2294 eol = strchr(txt,
'\n');
static void tts_buffer_heap_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
bool(* receiveSlot)(TupleTableSlot *slot, DestReceiver *self)
HeapTuple heap_copytuple(HeapTuple tuple)
static void tts_buffer_heap_store_tuple(TupleTableSlot *slot, HeapTuple tuple, Buffer buffer, bool transfer_pin)
int ExecTargetListLength(List *targetlist)
#define IsA(nodeptr, _type_)
TupleTableSlot * ExecStoreMinimalTuple(MinimalTuple mtup, TupleTableSlot *slot, bool shouldFree)
TupleTableSlot * ExecInitExtraTupleSlot(EState *estate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
#define att_align_nominal(cur_offset, attalign)
#define VARATT_IS_EXTERNAL_EXPANDED(PTR)
TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod)
static void tts_minimal_materialize(TupleTableSlot *slot)
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
TupleDesc CreateTemplateTupleDesc(int natts)
TupleDesc ExecCleanTypeFromTL(List *targetList)
TupleTableSlot * ExecStoreAllNullTuple(TupleTableSlot *slot)
HeapTuple(* copy_heap_tuple)(TupleTableSlot *slot)
static HeapTuple tts_buffer_heap_get_heap_tuple(TupleTableSlot *slot)
TupleTableSlot * MakeSingleTupleTableSlot(TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
static void tts_heap_materialize(TupleTableSlot *slot)
static TupleDesc ExecTypeFromTLInternal(List *targetList, bool skipjunk)
void namestrcpy(Name name, const char *str)
int32 exprTypmod(const Node *expr)
#define att_isnull(ATT, BITS)
#define PointerGetDatum(X)
HeapTupleHeaderData * HeapTupleHeader
#define TTS_SHOULDFREE(slot)
MinimalTuple ExecFetchSlotMinimalTuple(TupleTableSlot *slot, bool *shouldFree)
#define TupleDescAttr(tupdesc, i)
const TupleTableSlotOps TTSOpsBufferHeapTuple
static HeapTuple tts_virtual_copy_heap_tuple(TupleTableSlot *slot)
static void tts_minimal_getsomeattrs(TupleTableSlot *slot, int natts)
static MinimalTuple tts_buffer_heap_copy_minimal_tuple(TupleTableSlot *slot)
const TupleTableSlotOps TTSOpsVirtual
void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull)
static void tts_minimal_init(TupleTableSlot *slot)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
#define TTS_FLAG_SHOULDFREE
#define TTS_IS_MINIMALTUPLE(slot)
const TupleTableSlotOps *const tts_ops
#define MemSet(start, val, len)
void(* release)(TupleTableSlot *slot)
TupleTableSlot * ss_ScanTupleSlot
void ReleaseBuffer(Buffer buffer)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
struct VirtualTupleTableSlot VirtualTupleTableSlot
void heap_freetuple(HeapTuple htup)
static void tts_heap_clear(TupleTableSlot *slot)
static Datum tts_heap_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
#define DatumGetHeapTupleHeader(X)
MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup)
static HeapTuple tts_minimal_copy_heap_tuple(TupleTableSlot *slot)
static MinimalTuple tts_minimal_get_minimal_tuple(TupleTableSlot *slot)
void ExecForceStoreHeapTuple(HeapTuple tuple, TupleTableSlot *slot, bool shouldFree)
const TupleTableSlotOps * resultops
HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values)
void assign_record_type_typmod(TupleDesc tupDesc)
#define HeapTupleHeaderGetTypMod(tup)
static pg_attribute_always_inline void slot_deform_heap_tuple(TupleTableSlot *slot, HeapTuple tuple, uint32 *offp, int natts)
static Datum tts_buffer_heap_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
TupleTableSlot * ps_ResultTupleSlot
static HeapTuple tts_heap_get_heap_tuple(TupleTableSlot *slot)
void pfree(void *pointer)
static void tts_virtual_getsomeattrs(TupleTableSlot *slot, int natts)
void end_tup_output(TupOutputState *tstate)
struct HeapTupleTableSlot HeapTupleTableSlot
Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
void ExecForceStoreMinimalTuple(MinimalTuple mtup, TupleTableSlot *slot, bool shouldFree)
void heap_free_minimal_tuple(MinimalTuple mtup)
#define HeapTupleHeaderGetNatts(tup)
HeapTuple(* get_heap_tuple)(TupleTableSlot *slot)
void fmgr_info(Oid functionId, FmgrInfo *finfo)
static void tts_virtual_init(TupleTableSlot *slot)
void(* rStartup)(DestReceiver *self, int operation, TupleDesc typeinfo)
TupOutputState * begin_tup_output_tupdesc(DestReceiver *dest, TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
void TupleDescInitEntryCollation(TupleDesc desc, AttrNumber attributeNumber, Oid collationid)
static void slot_getallattrs(TupleTableSlot *slot)
void(* init)(TupleTableSlot *slot)
#define lfirst_node(type, lc)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
#define HeapTupleHasNulls(tuple)
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
static HeapTuple tts_buffer_heap_copy_heap_tuple(TupleTableSlot *slot)
const TupleTableSlotOps * scanops
static MinimalTuple ExecCopySlotMinimalTuple(TupleTableSlot *slot)
static Datum tts_virtual_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
text * cstring_to_text_with_len(const char *s, int len)
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
static MinimalTuple tts_minimal_copy_minimal_tuple(TupleTableSlot *slot)
void ExecInitResultTypeTL(PlanState *planstate)
static void tts_heap_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
FormData_pg_attribute * Form_pg_attribute
static void tts_buffer_heap_init(TupleTableSlot *slot)
MinimalTuple(* get_minimal_tuple)(TupleTableSlot *slot)
MemoryContext CurrentMemoryContext
Size EOH_get_flat_size(ExpandedObjectHeader *eohptr)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
static Datum tts_minimal_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
#define att_addlength_pointer(cur_offset, attlen, attptr)
void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam)
HeapTuple ExecFetchSlotHeapTuple(TupleTableSlot *slot, bool materialize, bool *shouldFree)
TupleTableSlot * ExecAllocTableSlot(List **tupleTable, TupleDesc desc, const TupleTableSlotOps *tts_ops)
Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc)
void ExecStoreHeapTupleDatum(Datum data, TupleTableSlot *slot)
static void tts_minimal_store_tuple(TupleTableSlot *slot, MinimalTuple mtup, bool shouldFree)
struct BufferHeapTupleTableSlot BufferHeapTupleTableSlot
List * lappend(List *list, void *datum)
int ExecCleanTargetListLength(List *targetlist)
MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
static void tts_heap_release(TupleTableSlot *slot)
ExpandedObjectHeader * DatumGetEOHP(Datum d)
TupleDesc ps_ResultTupleDesc
HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup)
TupleDesc tts_tupleDescriptor
void do_text_output_multiline(TupOutputState *tstate, const char *txt)
void ExecResetTupleTable(List *tupleTable, bool shouldFree)
void * palloc0(Size size)
static void tts_minimal_release(TupleTableSlot *slot)
#define TTS_IS_BUFFERTUPLE(slot)
void ExecSetSlotDescriptor(TupleTableSlot *slot, TupleDesc tupdesc)
static void tts_virtual_materialize(TupleTableSlot *slot)
static MinimalTuple tts_heap_copy_minimal_tuple(TupleTableSlot *slot)
AttInMetadata * TupleDescGetAttInMetadata(TupleDesc tupdesc)
void EOH_flatten_into(ExpandedObjectHeader *eohptr, void *result, Size allocated_size)
#define att_align_pointer(cur_offset, attalign, attlen, attptr)
#define HeapTupleHeaderGetTypeId(tup)
TupleTableSlot * ExecStoreBufferHeapTuple(HeapTuple tuple, TupleTableSlot *slot, Buffer buffer)
static void tts_buffer_heap_clear(TupleTableSlot *slot)
#define HeapTupleHeaderHasExternal(tup)
TupleTableSlot * MakeTupleTableSlot(TupleDesc tupleDesc, const TupleTableSlotOps *tts_ops)
static void ExecMaterializeSlot(TupleTableSlot *slot)
static MinimalTuple tts_virtual_copy_minimal_tuple(TupleTableSlot *slot)
Datum InputFunctionCall(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod)
static HeapTuple ExecCopySlotHeapTuple(TupleTableSlot *slot)
struct MinimalTupleTableSlot MinimalTupleTableSlot
MinimalTuple(* copy_minimal_tuple)(TupleTableSlot *slot)
static void tts_buffer_heap_getsomeattrs(TupleTableSlot *slot, int natts)
Datum toast_flatten_tuple_to_datum(HeapTupleHeader tup, uint32 tup_len, TupleDesc tupleDesc)
static void tts_minimal_clear(TupleTableSlot *slot)
#define TTS_IS_HEAPTUPLE(slot)
#define Assert(condition)
static void tts_heap_init(TupleTableSlot *slot)
TupleTableSlot * ExecInitNullTupleSlot(EState *estate, TupleDesc tupType, const TupleTableSlotOps *tts_ops)
void ExecInitResultSlot(PlanState *planstate, const TupleTableSlotOps *tts_ops)
static void tts_minimal_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
static void tts_virtual_clear(TupleTableSlot *slot)
Oid exprType(const Node *expr)
static int list_length(const List *l)
Oid exprCollation(const Node *expr)
TupleDesc ExecTypeFromTL(List *targetList)
#define BufferIsValid(bufnum)
void ExecInitResultTupleSlotTL(PlanState *planstate, const TupleTableSlotOps *tts_ops)
void(* getsomeattrs)(TupleTableSlot *slot, int natts)
static void tts_heap_getsomeattrs(TupleTableSlot *slot, int natts)
#define MINIMAL_TUPLE_OFFSET
TupleTableSlot * ExecStorePinnedBufferHeapTuple(HeapTuple tuple, TupleTableSlot *slot, Buffer buffer)
void(* materialize)(TupleTableSlot *slot)
void(* rShutdown)(DestReceiver *self)
#define DatumGetPointer(X)
static void tts_buffer_heap_materialize(TupleTableSlot *slot)
#define PinTupleDesc(tupdesc)
struct AttrMissing * missing
void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)
static Datum values[MAXATTR]
#define ItemPointerSetInvalid(pointer)
#define att_addlength_datum(cur_offset, attlen, attdatum)
MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup)
Datum HeapTupleHeaderGetDatum(HeapTupleHeader tuple)
TupleDesc ExecTypeFromExprList(List *exprList)
static void tts_virtual_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
void slot_getmissingattrs(TupleTableSlot *slot, int startAttNum, int lastAttNum)
void * MemoryContextAlloc(MemoryContext context, Size size)
static HeapTuple tts_heap_copy_heap_tuple(TupleTableSlot *slot)
void list_free(List *list)
const TupleTableSlotOps TTSOpsHeapTuple
static void tts_heap_store_tuple(TupleTableSlot *slot, HeapTuple tuple, bool shouldFree)
#define pg_attribute_always_inline
void slot_getsomeattrs_int(TupleTableSlot *slot, int attnum)
static void tts_buffer_heap_release(TupleTableSlot *slot)
#define ReleaseTupleDesc(tupdesc)
Datum ExecFetchSlotHeapTupleDatum(TupleTableSlot *slot)
void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList)
const TupleTableSlotOps TTSOpsMinimalTuple
void IncrBufferRefCount(Buffer buffer)
TupleTableSlot * ExecStoreHeapTuple(HeapTuple tuple, TupleTableSlot *slot, bool shouldFree)
TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)
static void tts_virtual_release(TupleTableSlot *slot)
#define HeapTupleHeaderGetDatumLength(tup)