commit 5a2f1314d197c037dfd55ea1dc0395f46333c05d Author: Shigeru Hanada Date: Fri Oct 21 11:54:39 2011 +0900 Add document about helper functions for FDW authors. diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml index 76ff243..db02d13 100644 --- a/doc/src/sgml/fdwhandler.sgml +++ b/doc/src/sgml/fdwhandler.sgml @@ -235,4 +235,98 @@ EndForeignScan (ForeignScanState *node); + + Foreign Data Wrapper Helper Functions + + + Several helper functions are exported from core so that authors of FDW + can get easy access to attributes of FDW-related objects such as FDW + options. + + + + +ForeignDataWrapper * +GetForeignDataWrapper(Oid fdwid); + + + This function returns a ForeignDataWrapper object + for a foreign-data wrapper with given oid. A + ForeignDataWrapper object contains oid of the + wrapper itself, oid of the owner of the wrapper, name of the wrapper, oid + of fdwhandler function, oid of fdwvalidator function, and FDW options in + the form of list of DefElem. + + + + +ForeignServer * +GetForeignServer(Oid serverid); + + + This function returns a ForeignServer object for + a foreign server with given oid. A ForeignServer + object contains oid of the server, oid of the wrapper for the server, oid + of the owner of the server, name of the server, type of the server, + version of the server, and FDW options in the form of list of + DefElem. + + + + +UserMapping * +GetUserMapping(Oid userid, Oid serverid); + + + This function returns a UserMapping object for a + user mapping with given oid pair. A UserMapping + object contains oid of the user, oid of the server, and FDW options in the + form of list of DefElem. + + + + +ForeignTable * +GetForeignTable(Oid relid); + + + This function returns a ForeignTable object for a + foreign table with given oid. A ForeignTable + object contains oid of the foreign table, oid of the server for the table, + and FDW options in the form of list of DefElem. + + + + Some object types have name-based functions. + + + + +ForeignDataWrapper * +GetForeignDataWrapperByName(const char *name, bool missing_ok); + + + This function returns a ForeignDataWrapper object + for a foreign-data wrapper with given name. If the wrapper is not found, + return NULL if missing_ok was true, otherwise raise an error. + + + + +ForeignServer * +GetForeignServerByName(const char *name, bool missing_ok); + + + This function returns a ForeignServer object for + a foreign server with given name. If the server is not found, return NULL + if missing_ok was true, otherwise raise an error. + + + + To use any of these functions, you need to include + foreign/foreign.h in your source file. + + + +