131 elog(
ERROR,
"getsomeattrs is not required to be called on a virtual tuple table slot");
145 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
146 errmsg(
"cannot retrieve a system column in this context")));
171 for (
int natt = 0; natt < desc->
natts; natt++)
181 if (att->attlen == -1 &&
207 for (
int natt = 0; natt < desc->
natts; natt++)
217 if (att->attlen == -1 &&
238 Size data_length = 0;
262 for (
int natt = 0; natt < srcdesc->
natts; natt++)
352 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
353 errmsg(
"cannot retrieve a system column in this context")));
455 hslot->
tuple = tuple;
520 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
521 errmsg(
"cannot retrieve a system column in this context")));
683 bslot->base.tuple = NULL;
709 if (!bslot->base.tuple)
711 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
712 errmsg(
"cannot retrieve a system column in this context")));
739 if (!bslot->base.tuple)
790 !bsrcslot->base.tuple)
814 memcpy(&bdstslot->base.tupdata, bdstslot->base.tuple,
sizeof(
HeapTupleData));
815 bdstslot->base.tuple = &bdstslot->base.tupdata;
826 if (!bslot->base.tuple)
829 return bslot->base.tuple;
839 if (!bslot->base.tuple)
852 if (!bslot->base.tuple)
860 Buffer buffer,
bool transfer_pin)
875 bslot->base.tuple = tuple;
890 if (bslot->
buffer != buffer)
960 tp = (
char *) tup + tup->
t_hoff;
976 if (!slow && thisatt->attcacheoff >= 0)
977 off = thisatt->attcacheoff;
978 else if (thisatt->attlen == -1)
988 thisatt->attcacheoff = off;
1002 thisatt->attcacheoff = off;
1009 if (thisatt->attlen <= 0)
1016 slot->tts_nvalid =
attnum;
1039 .get_heap_tuple = NULL,
1040 .get_minimal_tuple = NULL,
1057 .get_minimal_tuple = NULL,
1073 .get_heap_tuple = NULL,
1091 .get_minimal_tuple = NULL,
1135 slot->
type = T_TupleTableSlot;
1137 if (tupleDesc != NULL)
1143 if (tupleDesc != NULL)
1176 *tupleTable =
lappend(*tupleTable, slot);
1196 foreach(lc, tupleTable)
1364 elog(
ERROR,
"trying to store a heap tuple into wrong type of slot");
1405 elog(
ERROR,
"trying to store an on-disk heap tuple into wrong type of slot");
1431 elog(
ERROR,
"trying to store an on-disk heap tuple into wrong type of slot");
1458 elog(
ERROR,
"trying to store a minimal tuple into wrong type of slot");
1665 *shouldFree =
false;
1704 *shouldFree =
false;
1815 tupledesc, tts_ops);
1879 (lastAttNum - startAttNum) *
sizeof(
Datum));
1881 (lastAttNum - startAttNum) *
sizeof(
bool));
1888 for (missattnum = startAttNum;
1889 missattnum < lastAttNum;
1969 foreach(l, targetList)
1973 if (skipjunk && tle->resjunk)
2005 foreach(lc, exprList)
2039 foreach(lc, namesList)
2045 if (colno >= typeInfo->
natts)
2054 if (
cname[0] ==
'\0' || attr->attisdropped)
2073 if (tupdesc->
tdtypeid == RECORDOID &&
2088 int natts = tupdesc->
natts;
2109 for (
i = 0;
i < natts;
i++)
2114 if (!att->attisdropped)
2116 atttypeid = att->atttypid;
2119 atttypmods[
i] = att->atttypmod;
2138 int natts = tupdesc->
natts;
2145 nulls = (
bool *)
palloc(natts *
sizeof(
bool));
2151 for (
i = 0;
i < natts;
i++)
2285 memcpy(slot->
tts_isnull, isnull, natts *
sizeof(
bool));
2306 bool isnull[1] = {
false};
2313 eol = strchr(txt,
'\n');
static Datum values[MAXATTR]
void IncrBufferRefCount(Buffer buffer)
void ReleaseBuffer(Buffer buffer)
static bool BufferIsValid(Buffer bufnum)
#define pg_attribute_always_inline
#define MemSet(start, val, len)
elog(ERROR, "%s: %s", p2, msg)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
static void tts_heap_store_tuple(TupleTableSlot *slot, HeapTuple tuple, bool shouldFree)
static void tts_buffer_heap_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
static void tts_buffer_heap_store_tuple(TupleTableSlot *slot, HeapTuple tuple, Buffer buffer, bool transfer_pin)
static HeapTuple tts_minimal_copy_heap_tuple(TupleTableSlot *slot)
void ExecResetTupleTable(List *tupleTable, bool shouldFree)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
static Datum tts_heap_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
static HeapTuple tts_buffer_heap_copy_heap_tuple(TupleTableSlot *slot)
HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values)
static void tts_buffer_heap_clear(TupleTableSlot *slot)
AttInMetadata * TupleDescGetAttInMetadata(TupleDesc tupdesc)
static void tts_minimal_store_tuple(TupleTableSlot *slot, MinimalTuple mtup, bool shouldFree)
TupleTableSlot * MakeTupleTableSlot(TupleDesc tupleDesc, const TupleTableSlotOps *tts_ops)
const TupleTableSlotOps TTSOpsVirtual
TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
static MinimalTuple tts_heap_copy_minimal_tuple(TupleTableSlot *slot)
static Datum tts_buffer_heap_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
TupleTableSlot * ExecStoreBufferHeapTuple(HeapTuple tuple, TupleTableSlot *slot, Buffer buffer)
static void tts_minimal_init(TupleTableSlot *slot)
static void tts_heap_init(TupleTableSlot *slot)
static MinimalTuple tts_minimal_copy_minimal_tuple(TupleTableSlot *slot)
Datum HeapTupleHeaderGetDatum(HeapTupleHeader tuple)
static TupleDesc ExecTypeFromTLInternal(List *targetList, bool skipjunk)
static HeapTuple tts_buffer_heap_get_heap_tuple(TupleTableSlot *slot)
TupleDesc ExecCleanTypeFromTL(List *targetList)
static HeapTuple tts_virtual_copy_heap_tuple(TupleTableSlot *slot)
void ExecInitResultSlot(PlanState *planstate, const TupleTableSlotOps *tts_ops)
TupleTableSlot * ExecInitNullTupleSlot(EState *estate, TupleDesc tupType, const TupleTableSlotOps *tts_ops)
void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList)
void ExecForceStoreMinimalTuple(MinimalTuple mtup, TupleTableSlot *slot, bool shouldFree)
const TupleTableSlotOps TTSOpsBufferHeapTuple
static void tts_buffer_heap_release(TupleTableSlot *slot)
void end_tup_output(TupOutputState *tstate)
static void tts_minimal_clear(TupleTableSlot *slot)
MinimalTuple ExecFetchSlotMinimalTuple(TupleTableSlot *slot, bool *shouldFree)
TupleTableSlot * ExecStoreAllNullTuple(TupleTableSlot *slot)
TupleTableSlot * ExecStoreMinimalTuple(MinimalTuple mtup, TupleTableSlot *slot, bool shouldFree)
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
void ExecInitResultTypeTL(PlanState *planstate)
static void tts_virtual_clear(TupleTableSlot *slot)
static void tts_buffer_heap_materialize(TupleTableSlot *slot)
void do_text_output_multiline(TupOutputState *tstate, const char *txt)
static void tts_virtual_release(TupleTableSlot *slot)
HeapTuple ExecFetchSlotHeapTuple(TupleTableSlot *slot, bool materialize, bool *shouldFree)
void slot_getmissingattrs(TupleTableSlot *slot, int startAttNum, int lastAttNum)
TupleTableSlot * ExecInitExtraTupleSlot(EState *estate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
static void tts_minimal_materialize(TupleTableSlot *slot)
static MinimalTuple tts_buffer_heap_copy_minimal_tuple(TupleTableSlot *slot)
static MinimalTuple tts_minimal_get_minimal_tuple(TupleTableSlot *slot)
static void tts_minimal_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
TupleTableSlot * ExecStoreHeapTuple(HeapTuple tuple, TupleTableSlot *slot, bool shouldFree)
static void tts_virtual_init(TupleTableSlot *slot)
void ExecStoreHeapTupleDatum(Datum data, TupleTableSlot *slot)
void ExecSetSlotDescriptor(TupleTableSlot *slot, TupleDesc tupdesc)
void ExecInitResultTupleSlotTL(PlanState *planstate, const TupleTableSlotOps *tts_ops)
static void tts_minimal_release(TupleTableSlot *slot)
Datum ExecFetchSlotHeapTupleDatum(TupleTableSlot *slot)
const TupleTableSlotOps TTSOpsHeapTuple
static HeapTuple tts_heap_copy_heap_tuple(TupleTableSlot *slot)
void slot_getsomeattrs_int(TupleTableSlot *slot, int attnum)
static Datum tts_minimal_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
const TupleTableSlotOps TTSOpsMinimalTuple
static pg_attribute_always_inline void slot_deform_heap_tuple(TupleTableSlot *slot, HeapTuple tuple, uint32 *offp, int natts)
static void tts_virtual_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
static void tts_buffer_heap_getsomeattrs(TupleTableSlot *slot, int natts)
void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull)
TupleTableSlot * ExecStorePinnedBufferHeapTuple(HeapTuple tuple, TupleTableSlot *slot, Buffer buffer)
static void tts_virtual_getsomeattrs(TupleTableSlot *slot, int natts)
TupOutputState * begin_tup_output_tupdesc(DestReceiver *dest, TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
TupleDesc ExecTypeFromExprList(List *exprList)
static void tts_heap_materialize(TupleTableSlot *slot)
static MinimalTuple tts_virtual_copy_minimal_tuple(TupleTableSlot *slot)
static void tts_virtual_materialize(TupleTableSlot *slot)
TupleDesc ExecTypeFromTL(List *targetList)
static HeapTuple tts_heap_get_heap_tuple(TupleTableSlot *slot)
static void tts_minimal_getsomeattrs(TupleTableSlot *slot, int natts)
TupleTableSlot * ExecAllocTableSlot(List **tupleTable, TupleDesc desc, const TupleTableSlotOps *tts_ops)
static void tts_heap_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
static void tts_heap_clear(TupleTableSlot *slot)
static void tts_heap_getsomeattrs(TupleTableSlot *slot, int natts)
static void tts_heap_release(TupleTableSlot *slot)
static void tts_buffer_heap_init(TupleTableSlot *slot)
TupleTableSlot * MakeSingleTupleTableSlot(TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
void ExecForceStoreHeapTuple(HeapTuple tuple, TupleTableSlot *slot, bool shouldFree)
static Datum tts_virtual_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
int ExecTargetListLength(List *targetlist)
int ExecCleanTargetListLength(List *targetlist)
ExpandedObjectHeader * DatumGetEOHP(Datum d)
void EOH_flatten_into(ExpandedObjectHeader *eohptr, void *result, Size allocated_size)
Size EOH_get_flat_size(ExpandedObjectHeader *eohptr)
Datum InputFunctionCall(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod)
void fmgr_info(Oid functionId, FmgrInfo *finfo)
#define DatumGetHeapTupleHeader(X)
Datum toast_flatten_tuple_to_datum(HeapTupleHeader tup, uint32 tup_len, TupleDesc tupleDesc)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
HeapTuple heap_copytuple(HeapTuple tuple)
MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup)
Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
void heap_free_minimal_tuple(MinimalTuple mtup)
void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)
MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup)
Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc)
HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup)
void heap_freetuple(HeapTuple htup)
HeapTupleHeaderData * HeapTupleHeader
#define MINIMAL_TUPLE_OFFSET
#define HeapTupleHeaderGetTypMod(tup)
#define HeapTupleHeaderGetNatts(tup)
#define HeapTupleHeaderGetTypeId(tup)
#define HeapTupleHeaderGetDatumLength(tup)
#define HeapTupleHeaderHasExternal(tup)
#define HeapTupleHasNulls(tuple)
static void ItemPointerSetInvalid(ItemPointerData *pointer)
Assert(fmt[strlen(fmt) - 1] !='\n')
List * lappend(List *list, void *datum)
void list_free(List *list)
void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam)
void pfree(void *pointer)
void * palloc0(Size size)
MemoryContext CurrentMemoryContext
void * MemoryContextAlloc(MemoryContext context, Size size)
void namestrcpy(Name name, const char *str)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
Oid exprCollation(const Node *expr)
#define IsA(nodeptr, _type_)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
FormData_pg_attribute * Form_pg_attribute
#define lfirst_node(type, lc)
static int list_length(const List *l)
static Datum PointerGetDatum(const void *X)
static Pointer DatumGetPointer(Datum X)
const TupleTableSlotOps * resultops
const TupleTableSlotOps * scanops
TupleDesc ps_ResultTupleDesc
TupleTableSlot * ps_ResultTupleSlot
TupleTableSlot * ss_ScanTupleSlot
struct AttrMissing * missing
HeapTuple(* get_heap_tuple)(TupleTableSlot *slot)
void(* init)(TupleTableSlot *slot)
MinimalTuple(* copy_minimal_tuple)(TupleTableSlot *slot)
void(* getsomeattrs)(TupleTableSlot *slot, int natts)
HeapTuple(* copy_heap_tuple)(TupleTableSlot *slot)
MinimalTuple(* get_minimal_tuple)(TupleTableSlot *slot)
void(* materialize)(TupleTableSlot *slot)
void(* release)(TupleTableSlot *slot)
TupleDesc tts_tupleDescriptor
const TupleTableSlotOps *const tts_ops
void(* rStartup)(DestReceiver *self, int operation, TupleDesc typeinfo)
void(* rShutdown)(DestReceiver *self)
bool(* receiveSlot)(TupleTableSlot *slot, DestReceiver *self)
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescInitEntryCollation(TupleDesc desc, AttrNumber attributeNumber, Oid collationid)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
#define ReleaseTupleDesc(tupdesc)
#define PinTupleDesc(tupdesc)
#define TupleDescAttr(tupdesc, i)
#define att_align_pointer(cur_offset, attalign, attlen, attptr)
#define att_align_nominal(cur_offset, attalign)
static bool att_isnull(int ATT, const bits8 *BITS)
#define att_addlength_pointer(cur_offset, attlen, attptr)
#define att_addlength_datum(cur_offset, attlen, attdatum)
#define TTS_FLAG_SHOULDFREE
#define TTS_IS_MINIMALTUPLE(slot)
static MinimalTuple ExecCopySlotMinimalTuple(TupleTableSlot *slot)
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
struct MinimalTupleTableSlot MinimalTupleTableSlot
static HeapTuple ExecCopySlotHeapTuple(TupleTableSlot *slot)
#define TTS_IS_BUFFERTUPLE(slot)
static void slot_getallattrs(TupleTableSlot *slot)
struct HeapTupleTableSlot HeapTupleTableSlot
#define TTS_SHOULDFREE(slot)
struct BufferHeapTupleTableSlot BufferHeapTupleTableSlot
static void ExecMaterializeSlot(TupleTableSlot *slot)
struct VirtualTupleTableSlot VirtualTupleTableSlot
#define TTS_IS_HEAPTUPLE(slot)
TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod)
void assign_record_type_typmod(TupleDesc tupDesc)
#define VARATT_IS_EXTERNAL_EXPANDED(PTR)
text * cstring_to_text_with_len(const char *s, int len)