29#define TOAST_INDEX_HACK
76 unsigned short infomask = 0;
79 int numberOfAttributes = tupleDescriptor->
natts;
81#ifdef TOAST_INDEX_HACK
88 (
errcode(ERRCODE_TOO_MANY_COLUMNS),
89 errmsg(
"number of index columns (%d) exceeds limit (%d)",
92#ifdef TOAST_INDEX_HACK
93 for (
i = 0;
i < numberOfAttributes;
i++)
98 untoasted_free[
i] =
false;
101 if (isnull[
i] || att->attlen != -1)
110 untoasted_values[
i] =
113 untoasted_free[
i] =
true;
122 (att->attstorage == TYPSTORAGE_EXTENDED ||
123 att->attstorage == TYPSTORAGE_MAIN))
128 att->attcompression);
133 if (untoasted_free[
i])
135 untoasted_values[
i] = cvalue;
136 untoasted_free[
i] =
true;
142 for (
i = 0;
i < numberOfAttributes;
i++)
155#ifdef TOAST_INDEX_HACK
157 untoasted_values, isnull);
162 size = hoff + data_size;
180#ifdef TOAST_INDEX_HACK
181 for (
i = 0;
i < numberOfAttributes;
i++)
183 if (untoasted_free[
i])
198#ifdef TOAST_INDEX_HACK
208 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
209 errmsg(
"index row requires %zu bytes, maximum size is %zu",
249 tp = (
char *) tup + data_off;
290 for (
i = startAttr;
i < firstNullAttr;
i++)
323 for (
i = startAttr;
i < firstNullAttr;
i++)
389 char *tp,
uint8 *bp,
int hasnulls)
392 int natts = tupleDescriptor->
natts;
395 int firstNonCacheOffsetAttr;
409 firstNonCacheOffsetAttr =
Min(firstNonCacheOffsetAttr, firstNullAttr);
412 firstNullAttr = natts;
414 if (firstNonCacheOffsetAttr > 0)
416#ifdef USE_ASSERT_CHECKING
426#ifdef USE_ASSERT_CHECKING
434 }
while (++
attnum < firstNonCacheOffsetAttr);
516 Assert(leavenatts <= sourceDescriptor->natts);
519 if (leavenatts == sourceDescriptor->
natts)
static Datum values[MAXATTR]
#define Assert(condition)
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
varlena * detoast_external_attr(varlena *attr)
int errcode(int sqlerrcode)
#define ereport(elevel,...)
#define TOAST_INDEX_TARGET
Size heap_compute_data_size(TupleDesc tupleDesc, const Datum *values, const bool *isnull)
void heap_fill_tuple(TupleDesc tupleDesc, const Datum *values, const bool *isnull, char *data, Size data_size, uint16 *infomask, uint8 *bit)
void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor, Datum *values, bool *isnull)
IndexTuple index_truncate_tuple(TupleDesc sourceDescriptor, IndexTuple source, int leavenatts)
void index_deform_tuple_internal(TupleDesc tupleDescriptor, Datum *values, bool *isnull, char *tp, uint8 *bp, int hasnulls)
IndexTuple CopyIndexTuple(IndexTuple source)
IndexTuple index_form_tuple_context(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull, MemoryContext context)
Datum nocache_index_getattr(IndexTuple tup, int attnum, TupleDesc tupleDesc)
IndexTuple index_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
static bool IndexTupleHasVarwidths(const IndexTupleData *itup)
IndexTupleData * IndexTuple
static bool IndexTupleHasNulls(const IndexTupleData *itup)
static Size IndexTupleSize(const IndexTupleData *itup)
static Size IndexInfoFindDataOffset(unsigned short t_info)
void * MemoryContextAllocZero(MemoryContext context, Size size)
void pfree(void *pointer)
MemoryContext CurrentMemoryContext
FormData_pg_attribute * Form_pg_attribute
static rewind_source * source
static Datum PointerGetDatum(const void *X)
static Pointer DatumGetPointer(Datum X)
int firstNonCachedOffsetAttr
Datum toast_compress_datum(Datum value, char cmethod)
TupleDesc CreateTupleDescTruncatedCopy(TupleDesc tupdesc, int natts)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
static CompactAttribute * TupleDescCompactAttr(TupleDesc tupdesc, int i)
#define att_nominal_alignby(cur_offset, attalignby)
#define att_addlength_pointer(cur_offset, attlen, attptr)
static Datum align_fetch_then_add(const char *tupptr, uint32 *off, bool attbyval, int attlen, uint8 attalignby)
#define att_pointer_alignby(cur_offset, attalignby, attlen, attptr)
static Datum fetch_att_noerr(const void *T, bool attbyval, int attlen)
static int first_null_attr(const uint8 *bits, int natts)
static bool att_isnull(int ATT, const uint8 *BITS)
static bool VARATT_IS_EXTENDED(const void *PTR)
static bool VARATT_IS_EXTERNAL(const void *PTR)
static Size VARSIZE(const void *PTR)