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

TsmRoutine* GetTsmRoutine ( Oid  tsmhandler)

Definition at line 27 of file tablesample.c.

References DatumGetPointer, elog, ERROR, IsA, NULL, OidFunctionCall1, and PointerGetDatum.

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

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 IsA(nodeptr, _type_)
Definition: nodes.h:557
#define PointerGetDatum(X)
Definition: postgres.h:562
#define ERROR
Definition: elog.h:43
#define OidFunctionCall1(functionId, arg1)
Definition: fmgr.h:622
uintptr_t Datum
Definition: postgres.h:372
#define NULL
Definition: c.h:229
#define DatumGetPointer(X)
Definition: postgres.h:555
#define elog
Definition: elog.h:219