88 newsize =
Max(newsize, minsize);
108 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
109 errmsg(
"index row size %zu exceeds maximum %zu for index \"%s\"",
130 itup->
t_info &= ~INDEX_SIZE_MASK;
141 memcpy(ptr,
data, dataSize);
175 if (nipd != ndecoded)
176 elog(
ERROR,
"number of items mismatch in GIN entry tuple, %d in tuple header, %d decoded",
212 memcpy(nitup, itup, origsize);
214 nitup->
t_info &= ~INDEX_SIZE_MASK;
215 nitup->
t_info |= origsize;
425 for (
i = storedOff + 1;
i <= maxoff;
i++)
431 maxoff = storedOff - 1;
529 void **ptp_workspace,
570 elog(
ERROR,
"failed to add item to index page in \"%s\"",
630 ptr = tupstore[0].
data;
643 memcpy(ptr, itup,
size);
648 if (off == maxoff + 1)
663 ptr = tupstore[0].
data;
676 if (lsize > totalsize / 2)
688 elog(
ERROR,
"failed to add item to index page in \"%s\"",
731 elog(
ERROR,
"failed to add item to index root page");
736 elog(
ERROR,
"failed to add item to index root page");
#define InvalidBlockNumber
BlockNumber BufferGetBlockNumber(Buffer buffer)
void MarkBufferDirty(Buffer buffer)
static Page BufferGetPage(Buffer buffer)
void PageIndexTupleDelete(Page page, OffsetNumber offnum)
Page PageGetTempPageCopy(Page page)
Size PageGetFreeSpace(Page page)
static Item PageGetItem(Page page, ItemId itemId)
static Size PageGetPageSize(Page page)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static OffsetNumber PageGetMaxOffsetNumber(Page page)
#define PageAddItem(page, item, size, offsetNumber, overwrite, is_heap)
#define Assert(condition)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define GinIsPostingTree(itup)
#define GinPageGetOpaque(page)
#define GinCategoryOffset(itup, ginstate)
#define GinGetPosting(itup)
#define GinGetDownlink(itup)
#define GinSetNPosting(itup, n)
#define GinItupIsCompressed(itup)
#define GinSetPostingOffset(itup, n)
#define GinSetDownlink(itup, blkno)
#define GinGetNPosting(itup)
#define GinGetPostingOffset(itup)
#define GinPageIsData(page)
signed char GinNullCategory
#define GinPageRightMost(page)
#define GinSetNullCategory(itup, ginstate, c)
#define GinPageIsLeaf(page)
void ginEntryFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage)
static void entryPreparePage(GinBtree btree, Page page, OffsetNumber off, GinBtreeEntryInsertData *insertData, BlockNumber updateblkno)
static bool entryLocateLeafEntry(GinBtree btree, GinBtreeStack *stack)
static bool entryIsMoveRight(GinBtree btree, Page page)
static BlockNumber entryGetLeftMostPage(GinBtree btree, Page page)
static void entrySplitPage(GinBtree btree, Buffer origbuf, GinBtreeStack *stack, GinBtreeEntryInsertData *insertData, BlockNumber updateblkno, Page *newlpage, Page *newrpage)
static IndexTuple getRightMostTuple(Page page)
static IndexTuple GinFormInteriorTuple(IndexTuple itup, Page page, BlockNumber childblk)
static OffsetNumber entryFindChildPtr(GinBtree btree, Page page, BlockNumber blkno, OffsetNumber storedOff)
static bool entryIsEnoughSpace(GinBtree btree, Buffer buf, OffsetNumber off, GinBtreeEntryInsertData *insertData)
static GinPlaceToPageRC entryBeginPlaceToPage(GinBtree btree, Buffer buf, GinBtreeStack *stack, void *insertPayload, BlockNumber updateblkno, void **ptp_workspace, Page *newlpage, Page *newrpage)
ItemPointer ginReadTuple(GinState *ginstate, OffsetNumber attnum, IndexTuple itup, int *nitems)
static void entryExecPlaceToPage(GinBtree btree, Buffer buf, GinBtreeStack *stack, void *insertPayload, BlockNumber updateblkno, void *ptp_workspace)
static BlockNumber entryLocateEntry(GinBtree btree, GinBtreeStack *stack)
IndexTuple GinFormTuple(GinState *ginstate, OffsetNumber attnum, Datum key, GinNullCategory category, Pointer data, Size dataSize, int nipd, bool errorTooBig)
void ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum, Datum key, GinNullCategory category, GinState *ginstate)
static void * entryPrepareDownlink(GinBtree btree, Buffer lbuf)
ItemPointer ginPostingListDecode(GinPostingList *plist, int *ndecoded_out)
void GinInitPage(Page page, uint32 f, Size pageSize)
OffsetNumber gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple)
int ginCompareAttEntries(GinState *ginstate, OffsetNumber attnuma, Datum a, GinNullCategory categorya, OffsetNumber attnumb, Datum b, GinNullCategory categoryb)
Datum gintuple_get_key(GinState *ginstate, IndexTuple tuple, GinNullCategory *category)
IndexTuple index_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
struct ItemIdData ItemIdData
ItemPointerData * ItemPointer
#define IndexTupleHasNulls(itup)
IndexTupleData * IndexTuple
#define IndexTupleSize(itup)
void * repalloc(void *pointer, Size size)
void pfree(void *pointer)
#define InvalidOffsetNumber
#define FirstOffsetNumber
static Datum UInt16GetDatum(uint16 X)
#define RelationGetRelationName(relation)
#define RelationNeedsWAL(relation)
static pg_noinline void Size size
BlockNumber(* findChildPage)(GinBtree, GinBtreeStack *)
void(* execPlaceToPage)(GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void *)
BlockNumber(* getLeftMostChild)(GinBtree, Page)
bool(* findItem)(GinBtree, GinBtreeStack *)
void *(* prepareDownlink)(GinBtree, Buffer)
bool(* isMoveRight)(GinBtree, Page)
GinPlaceToPageRC(* beginPlaceToPage)(GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void **, Page *, Page *)
GinNullCategory entryCategory
OffsetNumber(* findChildPtr)(GinBtree, Page, BlockNumber, OffsetNumber)
void(* fillRoot)(GinBtree, Page, BlockNumber, Page, BlockNumber, Page)
TupleDesc tupdesc[INDEX_MAX_KEYS]
void XLogRegisterBufData(uint8 block_id, const char *data, uint32 len)
void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags)