PostgreSQL Source Code  git master
tablesample.c File Reference
#include "postgres.h"
#include "access/tsmapi.h"
Include dependency graph for tablesample.c:

Go to the source code of this file.

Functions

TsmRoutineGetTsmRoutine (Oid tsmhandler)
 

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:35
#define OidFunctionCall1(functionId, arg1)
Definition: fmgr.h:680
#define IsA(nodeptr, _type_)
Definition: nodes.h:162
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:670
uintptr_t Datum
Definition: postgres.h:412
static Pointer DatumGetPointer(Datum X)
Definition: postgres.h:660

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

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