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.


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;
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:33
#define OidFunctionCall1(functionId, arg1)
Definition: fmgr.h:669
#define IsA(nodeptr, _type_)
Definition: nodes.h:625
uintptr_t Datum
Definition: postgres.h:411
#define DatumGetPointer(X)
Definition: postgres.h:593
#define PointerGetDatum(X)
Definition: postgres.h:600

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

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