PostgreSQL Source Code  git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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
 

Typedefs

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
 

Functions

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;
31 
32  datum = OidFunctionCall1(tsmhandler, PointerGetDatum(NULL));
33  routine = (TsmRoutine *) DatumGetPointer(datum);
34 
35  if (routine == NULL || !IsA(routine, TsmRoutine))
36  elog(ERROR, "tablesample handler function %u did not return a TsmRoutine struct",
37  tsmhandler);
38 
39  return routine;
40 }
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:225
#define OidFunctionCall1(functionId, arg1)
Definition: fmgr.h:679
#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().