25#include "utils/fmgroids.h"
75 elog(
ERROR,
"invalid compression method %c", cmethod);
155 toasttupDesc = toastrel->
rd_att;
238 if (oldexternal != NULL)
304 while (data_todo > 0)
320 memcpy(
VARDATA(&chunk_data), data_p, chunk_size);
336 for (
i = 0;
i < num_indexes;
i++)
339 if (toastidxs[
i]->rd_index->indisready)
356 data_todo -= chunk_size;
357 data_p += chunk_size;
550 return validIndexOid;
581 foreach(lc, indexlist)
585 for (
i = 0;
i < *num_indexes;
i++)
608 elog(
ERROR,
"no valid index found for toast relation with Oid %u",
626 for (
i = 0;
i < num_indexes;
i++)
653 elog(
ERROR,
"cannot fetch toast data without an active snapshot");
#define Assert(condition)
#define OidIsValid(objectId)
Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
static void PGresult * res
#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)
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)
#define VARATT_IS_EXTERNAL_ONDISK(PTR)
#define VARSIZE_SHORT(PTR)
#define VARATT_IS_SHORT(PTR)
#define VARATT_EXTERNAL_SET_SIZE_AND_COMPRESS_METHOD(toast_pointer, len, cm)
#define SET_VARTAG_EXTERNAL(PTR, tag)
#define VARDATA_COMPRESSED_GET_EXTSIZE(PTR)
#define VARATT_EXTERNAL_IS_COMPRESSED(toast_pointer)
#define VARATT_IS_COMPRESSED(PTR)
#define VARDATA_EXTERNAL(PTR)
#define SET_VARSIZE(PTR, len)
#define VARATT_IS_EXTERNAL(PTR)
#define VARDATA_SHORT(PTR)
#define VARDATA_COMPRESSED_GET_COMPRESS_METHOD(PTR)
#define VARSIZE_ANY_EXHDR(PTR)
CommandId GetCurrentCommandId(bool used)