24#include "utils/fmgrprotos.h"
49 elog(
ERROR,
"failed to add item to GiST index page, item %d out of %d, size %zu bytes",
61 unsigned int size = freespace,
156 Datum *attr,
bool *isnull)
256 if (isnull1 ==
false &&
isnull2 ==
false)
258 evec->vector[0] = *entry1;
261 else if (isnull1 ==
false)
263 evec->vector[0] = *entry1;
264 evec->vector[1] = *entry1;
339 attr +
i, isnull +
i);
739 if (
isnan(penalty) || penalty < 0.0)
798 errmsg(
"index \"%s\" contains unexpected zero page at block %u",
801 errhint(
"Please REINDEX it.")));
809 errmsg(
"index \"%s\" contains corrupted page at block %u",
812 errhint(
"Please REINDEX it.")));
935 bool *res,
bool *isnull)
@ AMPROP_DISTANCE_ORDERABLE
static bool validate(Port *port, const char *auth)
#define InvalidBlockNumber
BlockNumber BufferGetBlockNumber(Buffer buffer)
Buffer ExtendBufferedRel(BufferManagerRelation bmr, ForkNumber forkNum, BufferAccessStrategy strategy, uint32 flags)
bool ConditionalLockBuffer(Buffer buffer)
void ReleaseBuffer(Buffer buffer)
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
static Page BufferGetPage(Buffer buffer)
static void LockBuffer(Buffer buffer, BufferLockMode mode)
Size PageGetFreeSpace(const PageData *page)
void PageInit(Page page, Size pageSize, Size specialSize)
static bool PageIsEmpty(const PageData *page)
static uint16 PageGetSpecialSize(const PageData *page)
static bool PageIsNew(const PageData *page)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static void * PageGetItem(PageData *page, const ItemIdData *itemId)
#define PageAddItem(page, item, size, offsetNumber, overwrite, is_heap)
static OffsetNumber PageGetMaxOffsetNumber(const PageData *page)
#define Assert(condition)
#define OidIsValid(objectId)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define repalloc_array(pointer, type, count)
#define palloc_array(type, count)
static float4 get_float4_infinity(void)
Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
Datum OidFunctionCall1Coll(Oid functionId, Oid collation, Datum arg1)
Datum FunctionCall3Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3)
Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation, Datum arg1)
#define PG_GETARG_INT32(n)
#define PG_RETURN_UINT16(x)
#define GIST_COMPRESS_PROC
#define GistPageIsLeaf(page)
#define GIST_TRANSLATE_CMPTYPE_PROC
#define GIST_DISTANCE_PROC
static FullTransactionId GistPageGetDeleteXid(Page page)
#define GistPageIsDeleted(page)
#define GistPageGetOpaque(page)
#define gistentryinit(e, k, r, pg, o, l)
void gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p, OffsetNumber o, GISTENTRY *attdata, bool *isnull)
bytea * gistoptions(Datum reloptions, bool validate)
Buffer gistNewBuffer(Relation r, Relation heaprel)
Datum gist_translate_cmptype_common(PG_FUNCTION_ARGS)
bool gistproperty(Oid index_oid, int attno, IndexAMProperty prop, const char *propname, bool *res, bool *isnull)
bool gistPageRecyclable(Page page)
void gistMakeUnionKey(GISTSTATE *giststate, int attno, GISTENTRY *entry1, bool isnull1, GISTENTRY *entry2, bool isnull2, Datum *dst, bool *dstisnull)
void gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len, Datum *attr, bool *isnull)
bool gistnospace(Page page, IndexTuple *itvec, int len, OffsetNumber todelete, Size freespace)
HeapTuple gistFetchTuple(GISTSTATE *giststate, Relation r, IndexTuple tuple)
bool gistKeyIsEQ(GISTSTATE *giststate, int attno, Datum a, Datum b)
static Datum gistFetchAtt(GISTSTATE *giststate, int nkey, Datum k, Relation r)
void gistfillbuffer(Page page, IndexTuple *itup, int len, OffsetNumber off)
IndexTuple gistFormTuple(GISTSTATE *giststate, Relation r, const Datum *attdata, const bool *isnull, bool isleaf)
IndexTuple * gistextractpage(Page page, int *len)
void gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e, Datum k, Relation r, Page pg, OffsetNumber o, bool l, bool isNull)
bool gistfitpage(IndexTuple *itvec, int len)
IndexTuple gistgetadjusted(Relation r, IndexTuple oldtup, IndexTuple addtup, GISTSTATE *giststate)
OffsetNumber gistchoose(Relation r, Page p, IndexTuple it, GISTSTATE *giststate)
XLogRecPtr gistGetFakeLSN(Relation rel)
void gistCompressValues(GISTSTATE *giststate, Relation r, const Datum *attdata, const bool *isnull, bool isleaf, Datum *compatt)
IndexTuple * gistjoinvector(IndexTuple *itvec, int *len, IndexTuple *additvec, int addlen)
void gistinitpage(Page page, uint32 f)
IndexTuple gistunion(Relation r, IndexTuple *itvec, int len, GISTSTATE *giststate)
void GISTInitBuffer(Buffer b, uint32 f)
StrategyNumber gisttranslatecmptype(CompareType cmptype, Oid opfamily)
void gistcheckpage(Relation rel, Buffer buf)
IndexTupleData * gistfillitupvec(IndexTuple *vec, int veclen, int *memlen)
float gistpenalty(GISTSTATE *giststate, int attno, GISTENTRY *orig, bool isNullOrig, GISTENTRY *add, bool isNullAdd)
XLogRecPtr gistXLogAssignLSN(void)
void gistXLogPageReuse(Relation rel, Relation heaprel, BlockNumber blkno, FullTransactionId deleteXid)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
BlockNumber GetFreeIndexPage(Relation rel)
IndexTuple index_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
static void ItemPointerSetOffsetNumber(ItemPointerData *pointer, OffsetNumber offsetNumber)
IndexTupleData * IndexTuple
static Datum index_getattr(IndexTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
static Size IndexTupleSize(const IndexTupleData *itup)
bool get_opclass_opfamily_and_input_type(Oid opclass, Oid *opfamily, Oid *opcintype)
Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)
Oid get_index_column_opclass(Oid index_oid, int attno)
#define InvalidOffsetNumber
#define OffsetNumberNext(offsetNumber)
#define FirstOffsetNumber
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
pg_prng_state pg_global_prng_state
bool pg_prng_bool(pg_prng_state *state)
static char buf[DEFAULT_XLOG_SEG_SIZE]
static Datum PointerGetDatum(const void *X)
static Datum Int16GetDatum(int16 X)
static Datum ObjectIdGetDatum(Oid X)
static uint16 DatumGetUInt16(Datum X)
static Pointer DatumGetPointer(Datum X)
static Datum Int32GetDatum(int32 X)
bool GlobalVisCheckRemovableFullXid(Relation rel, FullTransactionId fxid)
#define RelationGetRelationName(relation)
#define RelationNeedsWAL(relation)
#define IndexRelationGetNumberOfKeyAttributes(relation)
#define RelationIsPermanent(relation)
void * build_reloptions(Datum reloptions, bool validate, relopt_kind kind, Size relopt_struct_size, const relopt_parse_elt *relopt_elems, int num_relopt_elems)
#define RTOverlapStrategyNumber
#define RTEqualStrategyNumber
#define RTLessEqualStrategyNumber
#define RTGreaterEqualStrategyNumber
#define RTGreaterStrategyNumber
#define RTContainedByStrategyNumber
#define RTLessStrategyNumber
FmgrInfo fetchFn[INDEX_MAX_KEYS]
FmgrInfo penaltyFn[INDEX_MAX_KEYS]
Oid supportCollation[INDEX_MAX_KEYS]
FmgrInfo decompressFn[INDEX_MAX_KEYS]
FmgrInfo compressFn[INDEX_MAX_KEYS]
FmgrInfo equalFn[INDEX_MAX_KEYS]
FmgrInfo unionFn[INDEX_MAX_KEYS]
#define SearchSysCacheExists4(cacheId, key1, key2, key3, key4)
XLogRecPtr GetXLogInsertRecPtr(void)
XLogRecPtr GetFakeLSNForUnloggedRel(void)
#define XLogStandbyInfoActive()
#define XLogRecPtrIsValid(r)
#define FirstNormalUnloggedLSN
#define InvalidXLogRecPtr