Database Reference
In-Depth Information
Let's consider the various parameters mentioned in the preceding syntax:
name : This is the name of the foreign data wrapper to be created.
HANDLER handler_function : The handler_function is called to retrieve
the execution function. The return type of the function must be fdw_handler .
A foreign data wrapper without handler_function cannot
be accessed.
VALIDATOR validator_function : The foreign data wrapper has
functionality where we can provide a generic option while creating the
server, user mapping, and foreign data wrapper. The validator_function
is called to validate these generic options. If there is no validator function
speciied, then the option will not be checked.
Only a superuser can create foreign data wrappers.
The basic components of foreign data
wrappers
A PostgreSQL foreign data wrapper consists of many components. We are going to
explain them in detail, starting with the C ile.
The C ile
There is a need for a C programming source code ile that will contain the
implementation of handler_function and validator_function . The C
programming source should deine the handler and validator function as follows:
extern Datum dummy_fdw_handler (PG_FUNCTION_ARGS);
extern Datum dummy_fdw_validator (PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1 (dummy_fdw_handler);
PG_FUNCTION_INFO_V1 (dummy_fdw_validator);
The handler_function function, which is dummy_fdw_handler in the given
example, should return the FdwRoutine structure pointer. The FdwRoutine structure
contains the pointer of implementation call-back functions. The foreign data wrapper
calls the functions using these FdwRoutine function pointers.
 
Search WWH ::




Custom Search