217 scanstate->
begun =
false;
296 foreach(arg, scanstate->
args)
306 (
errcode(ERRCODE_INVALID_TABLESAMPLE_ARGUMENT),
307 errmsg(
"TABLESAMPLE parameter cannot be null")));
319 (
errcode(ERRCODE_INVALID_TABLESAMPLE_REPEAT),
320 errmsg(
"TABLESAMPLE REPEATABLE parameter cannot be null")));
339 seed = scanstate->
seed;
377 scanstate->
begun =
true;
421 Assert(blockno < scan->rs_nblocks);
542 Assert(blockno < scan->rs_nblocks);
582 int mid = (start + end) / 2;
585 if (tupoffset == curoffset)
587 else if (tupoffset < curoffset)
InitSampleScan_function InitSampleScan
#define DatumGetUInt32(X)
TupleTableSlot * ExecStoreTuple(HeapTuple tuple, TupleTableSlot *slot, Buffer buffer, bool shouldFree)
#define BUFFER_LOCK_UNLOCK
static bool SampleTupleVisible(HeapTuple tuple, OffsetNumber tupoffset, HeapScanDesc scan)
TupleTableSlot * ExecSampleScan(SampleScanState *node)
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate)
void heap_endscan(HeapScanDesc scan)
#define PageIsAllVisible(page)
#define RelationGetDescr(relation)
HeapTupleHeaderData * HeapTupleHeader
TupleTableSlot * ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)
ExprContext * ps_ExprContext
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
struct TableSampleClause * tablesample
int errcode(int sqlerrcode)
static HeapTuple tablesample_getnext(SampleScanState *scanstate)
void heapgetpage(HeapScanDesc scan, BlockNumber page)
static TupleTableSlot * SampleNext(SampleScanState *node)
TupleTableSlot * ss_ScanTupleSlot
void ReleaseBuffer(Buffer buffer)
#define DirectFunctionCall1(func, arg1)
Relation ss_currentRelation
#define PageGetMaxOffsetNumber(page)
void ExecFreeExprContext(PlanState *planstate)
void CheckForSerializableConflictOut(bool visible, Relation relation, HeapTuple tuple, Buffer buffer, Snapshot snapshot)
void ExecAssignResultTypeFromTL(PlanState *planstate)
#define HeapTupleSatisfiesVisibility(tuple, snapshot, buffer)
TupleTableSlot *(* ExecScanAccessMtd)(ScanState *node)
bool(* ExecScanRecheckMtd)(ScanState *node, TupleTableSlot *slot)
TupleTableSlot * ps_ResultTupleSlot
ExprState * ExecInitExpr(Expr *node, PlanState *parent)
#define ItemIdGetLength(itemId)
void pfree(void *pointer)
NextSampleTuple_function NextSampleTuple
void ExecAssignScanProjectionInfo(ScanState *node)
HeapScanDesc heap_beginscan_sampling(Relation relation, Snapshot snapshot, int nkeys, ScanKey key, bool allow_strat, bool allow_sync, bool allow_pagemode)
void ExecInitResultTupleSlot(EState *estate, PlanState *planstate)
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
SampleScanState * ExecInitSampleScan(SampleScan *node, EState *estate, int eflags)
NextSampleBlock_function NextSampleBlock
#define BufferGetPage(buffer)
BlockNumber rs_startblock
#define ereport(elevel, rest)
Datum ExecEvalExprSwitchContext(ExprState *expression, ExprContext *econtext, bool *isNull, ExprDoneCond *isDone)
Datum hashfloat8(PG_FUNCTION_ARGS)
static void tablesample_init(SampleScanState *scanstate)
#define PageGetItemId(page, offsetNumber)
static bool SampleRecheck(SampleScanState *node, TupleTableSlot *slot)
void LockBuffer(Buffer buffer, int mode)
void ExecEndSampleScan(SampleScanState *node)
#define BlockNumberIsValid(blockNumber)
TsmRoutine * GetTsmRoutine(Oid tsmhandler)
#define Assert(condition)
static void InitScanRelation(SampleScanState *node, EState *estate, int eflags)
OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]
void heap_rescan_set_params(HeapScanDesc scan, ScanKey key, bool allow_strat, bool allow_sync, bool allow_pagemode)
#define ItemIdIsNormal(itemId)
void ExecAssignExprContext(EState *estate, PlanState *planstate)
#define InvalidBlockNumber
static int list_length(const List *l)
void ExecCloseScanRelation(Relation scanrel)
#define BufferIsValid(bufnum)
struct TsmRoutine * tsmroutine
void ss_report_location(Relation rel, BlockNumber location)
BeginSampleScan_function BeginSampleScan
HeapScanDesc ss_currentScanDesc
int errmsg(const char *fmt,...)
void ExecReScanSampleScan(SampleScanState *node)
#define OffsetNumberIsValid(offsetNumber)
void ExecScanReScan(ScanState *node)
#define BUFFER_LOCK_SHARE
void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc)
#define CHECK_FOR_INTERRUPTS()
#define pgstat_count_heap_getnext(rel)
EndSampleScan_function EndSampleScan
#define PageGetItem(page, itemId)
#define ItemPointerSet(pointer, blockNumber, offNum)