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: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().