132 elog(
ERROR,
"getsomeattrs is not required to be called on a virtual tuple table slot");
146 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
147 errmsg(
"cannot retrieve a system column in this context")));
162 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
163 errmsg(
"don't have transaction information for this type of tuple")));
188 for (
int natt = 0; natt < desc->
natts; natt++)
198 if (att->attlen == -1 &&
224 for (
int natt = 0; natt < desc->
natts; natt++)
234 if (att->attlen == -1 &&
255 Size data_length = 0;
277 for (
int natt = 0; natt < srcdesc->
natts; natt++)
367 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
368 errmsg(
"cannot retrieve a system column in this context")));
389 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
390 errmsg(
"don't have a storage tuple in this context")));
493 hslot->
tuple = tuple;
562 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
563 errmsg(
"cannot retrieve a system column in this context")));
579 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
580 errmsg(
"don't have transaction information for this type of tuple")));
743 bslot->base.tuple = NULL;
769 if (!bslot->base.tuple)
771 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
772 errmsg(
"cannot retrieve a system column in this context")));
791 if (!bslot->base.tuple)
793 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
794 errmsg(
"don't have a storage tuple in this context")));
822 if (!bslot->base.tuple)
873 !bsrcslot->base.tuple)
897 memcpy(&bdstslot->base.tupdata, bdstslot->base.tuple,
sizeof(
HeapTupleData));
898 bdstslot->base.tuple = &bdstslot->base.tupdata;
909 if (!bslot->base.tuple)
912 return bslot->base.tuple;
922 if (!bslot->base.tuple)
935 if (!bslot->base.tuple)
943 Buffer buffer,
bool transfer_pin)
958 bslot->base.tuple = tuple;
973 if (bslot->
buffer != buffer)
1043 tp = (
char *) tup + tup->
t_hoff;
1059 if (!slow && thisatt->attcacheoff >= 0)
1060 off = thisatt->attcacheoff;
1061 else if (thisatt->attlen == -1)
1071 thisatt->attcacheoff = off;
1085 thisatt->attcacheoff = off;
1092 if (thisatt->attlen <= 0)
1099 slot->tts_nvalid =
attnum;
1123 .get_heap_tuple = NULL,
1124 .get_minimal_tuple = NULL,
1142 .get_minimal_tuple = NULL,
1159 .get_heap_tuple = NULL,
1178 .get_minimal_tuple = NULL,
1222 slot->
type = T_TupleTableSlot;
1224 if (tupleDesc != NULL)
1230 if (tupleDesc != NULL)
1263 *tupleTable =
lappend(*tupleTable, slot);
1283 foreach(lc, tupleTable)
1451 elog(
ERROR,
"trying to store a heap tuple into wrong type of slot");
1492 elog(
ERROR,
"trying to store an on-disk heap tuple into wrong type of slot");
1518 elog(
ERROR,
"trying to store an on-disk heap tuple into wrong type of slot");
1545 elog(
ERROR,
"trying to store a minimal tuple into wrong type of slot");
1752 *shouldFree =
false;
1791 *shouldFree =
false;
1902 tupledesc, tts_ops);
1966 (lastAttNum - startAttNum) *
sizeof(
Datum));
1968 (lastAttNum - startAttNum) *
sizeof(
bool));
1975 for (missattnum = startAttNum;
1976 missattnum < lastAttNum;
2056 foreach(l, targetList)
2060 if (skipjunk && tle->resjunk)
2092 foreach(lc, exprList)
2126 foreach(lc, namesList)
2132 if (colno >= typeInfo->
natts)
2141 if (
cname[0] ==
'\0' || attr->attisdropped)
2160 if (tupdesc->
tdtypeid == RECORDOID &&
2175 int natts = tupdesc->
natts;
2196 for (
i = 0;
i < natts;
i++)
2201 if (!att->attisdropped)
2203 atttypeid = att->atttypid;
2206 atttypmods[
i] = att->atttypmod;
2225 int natts = tupdesc->
natts;
2232 nulls = (
bool *)
palloc(natts *
sizeof(
bool));
2238 for (
i = 0;
i < natts;
i++)
2372 memcpy(slot->
tts_isnull, isnull, natts *
sizeof(
bool));
2393 bool isnull[1] = {
false};
2400 eol = strchr(txt,
'\n');
static Datum values[MAXATTR]
void IncrBufferRefCount(Buffer buffer)
void ReleaseBuffer(Buffer buffer)
static bool BufferIsValid(Buffer bufnum)
#define Assert(condition)
#define pg_attribute_always_inline
#define MemSet(start, val, len)
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)
void do_tup_output(TupOutputState *tstate, const Datum *values, const bool *isnull)
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 bool tts_buffer_is_current_xact_tuple(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 bool tts_virtual_is_current_xact_tuple(TupleTableSlot *slot)
static void tts_buffer_heap_getsomeattrs(TupleTableSlot *slot, int natts)
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 bool tts_minimal_is_current_xact_tuple(TupleTableSlot *slot)
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)
static bool tts_heap_is_current_xact_tuple(TupleTableSlot *slot)
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_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, const Datum *values, const bool *isnull)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const 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 HeapTupleHeaderGetRawXmin(tup)
#define HeapTupleHeaderHasExternal(tup)
#define HeapTupleHasNulls(tuple)
static void ItemPointerSetInvalid(ItemPointerData *pointer)
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_)
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)
MemoryContextSwitchTo(old_ctx)
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)
bool TransactionIdIsCurrentTransactionId(TransactionId xid)