From 5e45211a64149b3c659b90ff2de6fa982a5a93ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 14:17:33 +0200 Subject: Adding upstream version 15.5. Signed-off-by: Daniel Baumann --- doc/src/sgml/html/fdw-helpers.html | 114 +++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 doc/src/sgml/html/fdw-helpers.html (limited to 'doc/src/sgml/html/fdw-helpers.html') diff --git a/doc/src/sgml/html/fdw-helpers.html b/doc/src/sgml/html/fdw-helpers.html new file mode 100644 index 0000000..b77c43a --- /dev/null +++ b/doc/src/sgml/html/fdw-helpers.html @@ -0,0 +1,114 @@ + +59.3. Foreign Data Wrapper Helper Functions

59.3. Foreign Data Wrapper Helper Functions

+ Several helper functions are exported from the core server so that + authors of foreign data wrappers can get easy access to attributes of + FDW-related objects, such as FDW options. + To use any of these functions, you need to include the header file + foreign/foreign.h in your source file. + That header also defines the struct types that are returned by + these functions. +

+

+ForeignDataWrapper *
+GetForeignDataWrapperExtended(Oid fdwid, bits16 flags);
+

+ + This function returns a ForeignDataWrapper + object for the foreign-data wrapper with the given OID. A + ForeignDataWrapper object contains properties + of the FDW (see foreign/foreign.h for details). + flags is a bitwise-or'd bit mask indicating + an extra set of options. It can take the value + FDW_MISSING_OK, in which case a NULL + result is returned to the caller instead of an error for an undefined + object. +

+

+ForeignDataWrapper *
+GetForeignDataWrapper(Oid fdwid);
+

+ + This function returns a ForeignDataWrapper + object for the foreign-data wrapper with the given OID. A + ForeignDataWrapper object contains properties + of the FDW (see foreign/foreign.h for details). +

+

+ForeignServer *
+GetForeignServerExtended(Oid serverid, bits16 flags);
+

+ + This function returns a ForeignServer object + for the foreign server with the given OID. A + ForeignServer object contains properties + of the server (see foreign/foreign.h for details). + flags is a bitwise-or'd bit mask indicating + an extra set of options. It can take the value + FSV_MISSING_OK, in which case a NULL + result is returned to the caller instead of an error for an undefined + object. +

+

+ForeignServer *
+GetForeignServer(Oid serverid);
+

+ + This function returns a ForeignServer object + for the foreign server with the given OID. A + ForeignServer object contains properties + of the server (see foreign/foreign.h for details). +

+

+UserMapping *
+GetUserMapping(Oid userid, Oid serverid);
+

+ + This function returns a UserMapping object for + the user mapping of the given role on the given server. (If there is no + mapping for the specific user, it will return the mapping for + PUBLIC, or throw error if there is none.) A + UserMapping object contains properties of the + user mapping (see foreign/foreign.h for details). +

+

+ForeignTable *
+GetForeignTable(Oid relid);
+

+ + This function returns a ForeignTable object for + the foreign table with the given OID. A + ForeignTable object contains properties of the + foreign table (see foreign/foreign.h for details). +

+

+List *
+GetForeignColumnOptions(Oid relid, AttrNumber attnum);
+

+ + This function returns the per-column FDW options for the column with the + given foreign table OID and attribute number, in the form of a list of + DefElem. NIL is returned if the column has no + options. +

+ Some object types have name-based lookup functions in addition to the + OID-based ones: +

+

+ForeignDataWrapper *
+GetForeignDataWrapperByName(const char *name, bool missing_ok);
+

+ + This function returns a ForeignDataWrapper + object for the foreign-data wrapper with the given name. If the wrapper + is not found, return NULL if missing_ok is true, otherwise raise an + error. +

+

+ForeignServer *
+GetForeignServerByName(const char *name, bool missing_ok);
+

+ + This function returns a ForeignServer object + for the foreign server with the given name. If the server is not found, + return NULL if missing_ok is true, otherwise raise an error. +

\ No newline at end of file -- cgit v1.2.3