PostgreSQL Source Code  git master
tsmapi.h File Reference
#include "nodes/execnodes.h"
#include "nodes/pathnodes.h"
Include dependency graph for tsmapi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TsmRoutine


typedef void(* SampleScanGetSampleSize_function) (PlannerInfo *root, RelOptInfo *baserel, List *paramexprs, BlockNumber *pages, double *tuples)
typedef void(* InitSampleScan_function) (SampleScanState *node, int eflags)
typedef void(* BeginSampleScan_function) (SampleScanState *node, Datum *params, int nparams, uint32 seed)
typedef BlockNumber(* NextSampleBlock_function) (SampleScanState *node, BlockNumber nblocks)
typedef OffsetNumber(* NextSampleTuple_function) (SampleScanState *node, BlockNumber blockno, OffsetNumber maxoffset)
typedef void(* EndSampleScan_function) (SampleScanState *node)
typedef struct TsmRoutine TsmRoutine


TsmRoutineGetTsmRoutine (Oid tsmhandler)

Typedef Documentation

◆ BeginSampleScan_function

typedef void(* BeginSampleScan_function) (SampleScanState *node, Datum *params, int nparams, uint32 seed)

Definition at line 32 of file tsmapi.h.

◆ EndSampleScan_function

typedef void(* EndSampleScan_function) (SampleScanState *node)

Definition at line 44 of file tsmapi.h.

◆ InitSampleScan_function

typedef void(* InitSampleScan_function) (SampleScanState *node, int eflags)

Definition at line 29 of file tsmapi.h.

◆ NextSampleBlock_function

typedef BlockNumber(* NextSampleBlock_function) (SampleScanState *node, BlockNumber nblocks)

Definition at line 37 of file tsmapi.h.

◆ NextSampleTuple_function

typedef OffsetNumber(* NextSampleTuple_function) (SampleScanState *node, BlockNumber blockno, OffsetNumber maxoffset)

Definition at line 40 of file tsmapi.h.

◆ SampleScanGetSampleSize_function

typedef void(* SampleScanGetSampleSize_function) (PlannerInfo *root, RelOptInfo *baserel, List *paramexprs, BlockNumber *pages, double *tuples)

Definition at line 23 of file tsmapi.h.

◆ TsmRoutine

typedef struct TsmRoutine TsmRoutine

Function Documentation

◆ GetTsmRoutine()

TsmRoutine* GetTsmRoutine ( Oid  tsmhandler)

Definition at line 27 of file tablesample.c.

28 {
29  Datum datum;
30  TsmRoutine *routine;
32  datum = OidFunctionCall1(tsmhandler, PointerGetDatum(NULL));
33  routine = (TsmRoutine *) DatumGetPointer(datum);
35  if (routine == NULL || !IsA(routine, TsmRoutine))
36  elog(ERROR, "tablesample handler function %u did not return a TsmRoutine struct",
37  tsmhandler);
39  return routine;
40 }
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:224
#define OidFunctionCall1(functionId, arg1)
Definition: fmgr.h:680
#define IsA(nodeptr, _type_)
Definition: nodes.h:158
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:322
uintptr_t Datum
Definition: postgres.h:64
static Pointer DatumGetPointer(Datum X)
Definition: postgres.h:312

References DatumGetPointer(), elog, ERROR, IsA, OidFunctionCall1, and PointerGetDatum().

Referenced by cost_samplescan(), ExecInitSampleScan(), set_tablesample_rel_pathlist(), set_tablesample_rel_size(), and transformRangeTableSample().