275 cmpval = key->nextkey ? 0 : 1;
320 elog(
ERROR,
"fell off the end of index \"%s\"",
361 Assert(!key->nextkey || key->scantid ==
NULL);
392 cmpval = key->nextkey ? 0 : 1;
568 errmsg_internal(
"table tid from new index tuple (%u,%u) cannot find insert offset between offsets %u and %u of block %u in index \"%s\"",
629 Assert(key->heapkeyspace && key->allequalimage);
647 mid = low + ((high - low) / 2);
707 Assert(key->heapkeyspace || key->scantid ==
NULL);
802 if (key->scantid ==
NULL)
827 if (!key->backward && key->keysz ==
ntupatts && heapTid ==
NULL &&
930 if (
so->numArrayKeys && !
so->needPrimScan)
1034 if (
so->numberOfKeys > 0)
1056 for (
int i = 0;;
cur++,
i++)
1189 if (
i >=
so->numberOfKeys ||
1216 switch (
cur->sk_strategy)
1257 for (
int i = 0;
i < keysz;
i++)
1423 elog(
ERROR,
"missing support function %d(%u,%u) for attribute %d of index \"%s\"",
1447 inskey.
keysz = keysz;
1521#ifdef USE_INJECTION_POINTS
1605 if (++
so->currPos.itemIndex >
so->currPos.lastItem)
1613 if (--
so->currPos.itemIndex <
so->currPos.firstItem)
1635 Assert(
so->currPos.itemIndex >=
so->currPos.firstItem);
1636 Assert(
so->currPos.itemIndex <=
so->currPos.lastItem);
1663 if (
so->numKilled > 0)
1670 if (
so->markItemIndex >= 0)
1680 so->currPos.nextTupleOffset);
1681 so->markPos.itemIndex =
so->markItemIndex;
1682 so->markItemIndex = -1;
1700 if (
so->needPrimScan)
1703 so->markPos.moreRight =
true;
1705 so->markPos.moreLeft =
true;
1716 blkno =
so->currPos.nextPage;
1718 blkno =
so->currPos.prevPage;
1727 if (
so->currPos.dir != dir)
1728 so->needPrimScan =
false;
1759 so->markItemIndex = -1;
1762 if (
so->needPrimScan)
1766 so->currPos.moreLeft =
true;
1767 so->currPos.moreRight =
true;
1768 so->needPrimScan =
false;
1772 so->currPos.moreLeft =
false;
1773 so->currPos.moreRight =
true;
1777 so->currPos.moreLeft =
true;
1778 so->currPos.moreRight =
false;
1862 so->currPos.moreLeft =
true;
1864 so->currPos.moreRight =
true;
1873 !
so->currPos.moreRight : !
so->currPos.moreLeft))
1924 blkno =
so->currPos.nextPage;
1931 blkno =
so->currPos.prevPage;
1954 Assert(
so->currPos.currPage == blkno);
1987#ifdef USE_INJECTION_POINTS
2027#ifdef USE_INJECTION_POINTS
2049#ifdef USE_INJECTION_POINTS
2063 elog(
ERROR,
"fell off the end of index \"%s\"",
2081 elog(
ERROR,
"could not find left sibling of block %u in index \"%s\"",
2102#ifdef USE_INJECTION_POINTS
2158 elog(
ERROR,
"fell off the end of index \"%s\"",
2225#ifdef USE_INJECTION_POINTS
2267 elog(
ERROR,
"invalid scan direction: %d", (
int) dir);
#define InvalidBlockNumber
void IncrBufferRefCount(Buffer buffer)
BlockNumber BufferGetBlockNumber(Buffer buffer)
XLogRecPtr BufferGetLSNAtomic(Buffer buffer)
static Page BufferGetPage(Buffer buffer)
static bool BufferIsValid(Buffer bufnum)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static void * PageGetItem(PageData *page, const ItemIdData *itemId)
static OffsetNumber PageGetMaxOffsetNumber(const PageData *page)
#define RegProcedureIsValid(p)
#define INVERT_COMPARE_RESULT(var)
#define Assert(condition)
bool IsCatalogRelation(Relation relation)
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
int errcode(int sqlerrcode)
int int errmsg_internal(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
#define palloc_object(type)
Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
FmgrInfo * index_getprocinfo(Relation irel, AttrNumber attnum, uint16 procnum)
#define INJECTION_POINT(name, arg)
#define ItemIdIsDead(itemId)
int32 ItemPointerCompare(const ItemPointerData *arg1, const ItemPointerData *arg2)
static OffsetNumber ItemPointerGetOffsetNumber(const ItemPointerData *pointer)
static BlockNumber ItemPointerGetBlockNumber(const ItemPointerData *pointer)
IndexTupleData * IndexTuple
static Datum index_getattr(IndexTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)
#define CHECK_FOR_INTERRUPTS()
void _bt_finish_split(Relation rel, Relation heaprel, Buffer lbuf, BTStack stack)
Buffer _bt_relandgetbuf(Relation rel, Buffer obuf, BlockNumber blkno, int access)
void _bt_relbuf(Relation rel, Buffer buf)
Buffer _bt_gettrueroot(Relation rel)
void _bt_metaversion(Relation rel, bool *heapkeyspace, bool *allequalimage)
Buffer _bt_getbuf(Relation rel, BlockNumber blkno, int access)
void _bt_unlockbuf(Relation rel, Buffer buf)
void _bt_lockbuf(Relation rel, Buffer buf, int access)
Buffer _bt_getroot(Relation rel, Relation heaprel, int access)
void _bt_preprocess_keys(IndexScanDesc scan)
bool _bt_readpage(IndexScanDesc scan, ScanDirection dir, OffsetNumber offnum, bool firstpage)
void _bt_start_array_keys(IndexScanDesc scan, ScanDirection dir)
bool _bt_parallel_seize(IndexScanDesc scan, BlockNumber *next_scan_page, BlockNumber *last_curr_page, bool first)
void _bt_parallel_done(IndexScanDesc scan)
void _bt_parallel_release(IndexScanDesc scan, BlockNumber next_scan_page, BlockNumber curr_page)
#define BTScanPosIsPinned(scanpos)
static uint16 BTreeTupleGetNPosting(IndexTuple posting)
static bool BTreeTupleIsPivot(IndexTuple itup)
#define P_LEFTMOST(opaque)
#define BTPageGetOpaque(page)
#define P_ISDELETED(opaque)
#define BTScanPosIsValid(scanpos)
#define P_FIRSTDATAKEY(opaque)
#define P_RIGHTMOST(opaque)
#define SK_BT_NULLS_FIRST
#define P_INCOMPLETE_SPLIT(opaque)
static ItemPointer BTreeTupleGetPostingN(IndexTuple posting, int n)
static BlockNumber BTreeTupleGetDownLink(IndexTuple pivot)
static ItemPointer BTreeTupleGetMaxHeapTID(IndexTuple itup)
static bool BTreeTupleIsPosting(IndexTuple itup)
#define BTScanPosInvalidate(scanpos)
#define BTScanPosUnpinIfPinned(scanpos)
static ItemPointer BTreeTupleGetHeapTID(IndexTuple itup)
#define BTreeTupleGetNAtts(itup, rel)
BTScanOpaqueData * BTScanOpaque
Buffer _bt_get_endpoint(Relation rel, uint32 level, bool rightmost)
static Buffer _bt_moveright(Relation rel, Relation heaprel, BTScanInsert key, Buffer buf, bool forupdate, BTStack stack, int access)
static int _bt_binsrch_posting(BTScanInsert key, Page page, OffsetNumber offnum)
bool _bt_first(IndexScanDesc scan, ScanDirection dir)
static bool _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno, BlockNumber lastcurrblkno, ScanDirection dir, bool seized)
static OffsetNumber _bt_binsrch(Relation rel, BTScanInsert key, Buffer buf)
static bool _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
static bool _bt_steppage(IndexScanDesc scan, ScanDirection dir)
static bool _bt_readfirstpage(IndexScanDesc scan, OffsetNumber offnum, ScanDirection dir)
static Buffer _bt_lock_and_validate_left(Relation rel, BlockNumber *blkno, BlockNumber lastcurrblkno)
OffsetNumber _bt_binsrch_insert(Relation rel, BTInsertState insertstate)
bool _bt_next(IndexScanDesc scan, ScanDirection dir)
static void _bt_returnitem(IndexScanDesc scan, BTScanOpaque so)
int32 _bt_compare(Relation rel, BTScanInsert key, Page page, OffsetNumber offnum)
BTStack _bt_search(Relation rel, Relation heaprel, BTScanInsert key, Buffer *bufP, int access, bool returnstack)
static void _bt_drop_lock_and_maybe_pin(Relation rel, BTScanOpaque so)
void _bt_killitems(IndexScanDesc scan)
bool _bt_check_natts(Relation rel, bool heapkeyspace, Page page, OffsetNumber offnum)
#define InvalidOffsetNumber
#define OffsetNumberPrev(offsetNumber)
static char buf[DEFAULT_XLOG_SEG_SIZE]
#define pgstat_count_index_scan(rel)
static Pointer DatumGetPointer(Datum X)
static int32 DatumGetInt32(Datum X)
void PredicateLockRelation(Relation relation, Snapshot snapshot)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
#define IndexRelationGetNumberOfKeyAttributes(relation)
void ScanKeyEntryInitialize(ScanKey entry, int flags, AttrNumber attributeNumber, StrategyNumber strategy, Oid subtype, Oid collation, RegProcedure procedure, Datum argument)
void ScanKeyEntryInitializeWithInfo(ScanKey entry, int flags, AttrNumber attributeNumber, StrategyNumber strategy, Oid subtype, Oid collation, FmgrInfo *finfo, Datum argument)
#define ScanDirectionIsForward(direction)
#define ScanDirectionIsBackward(direction)
#define BTGreaterStrategyNumber
#define BTLessStrategyNumber
#define BTEqualStrategyNumber
#define BTLessEqualStrategyNumber
#define BTGreaterEqualStrategyNumber
ScanKeyData scankeys[INDEX_MAX_KEYS]
struct ParallelIndexScanDescData * parallel_scan
struct IndexScanInstrumentation * instrument
ItemPointerData xs_heaptid
struct SnapshotData * xs_snapshot
#define IsolationIsSerializable()