25#include "utils/fmgroids.h"
75 elog(
ERROR,
"invalid compression method %c", cmethod);
143 toasttupDesc = toastrel->
rd_att;
226 if (oldexternal != NULL)
283 while (data_todo > 0)
287 bool t_isnull[3] = {0};
311 memcpy(
VARDATA(&chunk_data), data_p, chunk_size);
329 for (
int i = 0;
i < num_indexes;
i++)
332 if (toastidxs[
i]->rd_index->indisready)
349 data_todo -= chunk_size;
350 data_p += chunk_size;
543 return validIndexOid;
574 foreach(lc, indexlist)
578 for (
i = 0;
i < *num_indexes;
i++)
601 elog(
ERROR,
"no valid index found for toast relation with Oid %u",
619 for (
i = 0;
i < num_indexes;
i++)
646 elog(
ERROR,
"cannot fetch toast data without an active snapshot");
#define OidIsValid(objectId)
Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
#define TOAST_POINTER_SIZE
#define VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr)
void systable_endscan(SysScanDesc sysscan)
SysScanDesc systable_beginscan_ordered(Relation heapRelation, Relation indexRelation, Snapshot snapshot, int nkeys, ScanKey key)
HeapTuple systable_getnext(SysScanDesc sysscan)
void systable_endscan_ordered(SysScanDesc sysscan)
HeapTuple systable_getnext_ordered(SysScanDesc sysscan, ScanDirection direction)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
Assert(PointerIsAligned(start, uint64))
void heap_insert(Relation relation, HeapTuple tup, CommandId cid, int options, BulkInsertState bistate)
void simple_heap_delete(Relation relation, ItemPointer tid)
void heap_abort_speculative(Relation relation, ItemPointer tid)
#define TOAST_MAX_CHUNK_SIZE
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void heap_freetuple(HeapTuple htup)
bool index_insert(Relation indexRelation, Datum *values, bool *isnull, ItemPointer heap_t_ctid, Relation heapRelation, IndexUniqueCheck checkUnique, bool indexUnchanged, IndexInfo *indexInfo)
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
void list_free(List *list)
void pfree(void *pointer)
#define CHECK_FOR_INTERRUPTS()
static int list_length(const List *l)
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
static Datum Int32GetDatum(int32 X)
#define RelationGetRelid(relation)
List * RelationGetIndexList(Relation relation)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
bool HaveRegisteredOrActiveSnapshot(void)
SnapshotData SnapshotToastData
#define BTEqualStrategyNumber
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
struct varlena * lz4_compress_datum(const struct varlena *value)
struct varlena * pglz_compress_datum(const struct varlena *value)
int default_toast_compression
#define CompressionMethodIsValid(cm)
@ TOAST_INVALID_COMPRESSION_ID
@ TOAST_LZ4_COMPRESSION_ID
@ TOAST_PGLZ_COMPRESSION_ID
#define TOAST_PGLZ_COMPRESSION
#define TOAST_LZ4_COMPRESSION
void toast_close_indexes(Relation *toastidxs, int num_indexes, LOCKMODE lock)
void toast_delete_datum(Relation rel, Datum value, bool is_speculative)
Datum toast_save_datum(Relation rel, Datum value, struct varlena *oldexternal, int options)
Datum toast_compress_datum(Datum value, char cmethod)
Oid toast_get_valid_index(Oid toastoid, LOCKMODE lock)
static bool toastid_valueid_exists(Oid toastrelid, Oid valueid)
static bool toastrel_valueid_exists(Relation toastrel, Oid valueid)
int toast_open_indexes(Relation toastrel, LOCKMODE lock, Relation **toastidxs, int *num_indexes)
Snapshot get_toast_snapshot(void)
#define TOAST_COMPRESS_SET_SIZE_AND_COMPRESS_METHOD(ptr, len, cm_method)
static bool VARATT_IS_SHORT(const void *PTR)
static Size VARDATA_COMPRESSED_GET_EXTSIZE(const void *PTR)
static bool VARATT_IS_EXTERNAL_ONDISK(const void *PTR)
#define VARATT_EXTERNAL_SET_SIZE_AND_COMPRESS_METHOD(toast_pointer, len, cm)
static uint32 VARDATA_COMPRESSED_GET_COMPRESS_METHOD(const void *PTR)
static Size VARSIZE_ANY_EXHDR(const void *PTR)
static bool VARATT_IS_EXTERNAL(const void *PTR)
static char * VARDATA_EXTERNAL(const void *PTR)
static Size VARSIZE(const void *PTR)
static char * VARDATA(const void *PTR)
static void SET_VARTAG_EXTERNAL(void *PTR, vartag_external tag)
static bool VARATT_IS_COMPRESSED(const void *PTR)
static char * VARDATA_SHORT(const void *PTR)
static bool VARATT_EXTERNAL_IS_COMPRESSED(struct varatt_external toast_pointer)
static void SET_VARSIZE(void *PTR, Size len)
static Size VARSIZE_SHORT(const void *PTR)
CommandId GetCurrentCommandId(bool used)