|
17 | 17 | to write a new foreign data wrapper.
|
18 | 18 | </para>
|
19 | 19 |
|
20 |
| - <para> |
21 |
| - The FDW author needs to implement a handler function, and optionally |
22 |
| - a validator function. Both functions must be written in a compiled |
23 |
| - language such as C, using the version-1 interface. |
24 |
| - For details on C language calling conventions and dynamic loading, |
25 |
| - see <xref linkend="xfunc-c">. |
26 |
| - </para> |
27 |
| - |
28 |
| - <para> |
29 |
| - The handler function simply returns a struct of function pointers to |
30 |
| - callback functions that will be called by the planner and executor. |
31 |
| - Most of the effort in writing an FDW is in implementing these callback |
32 |
| - functions. |
33 |
| - The handler function must be registered with |
34 |
| - <productname>PostgreSQL</productname> as taking no arguments and returning |
35 |
| - the special pseudo-type <type>fdw_handler</type>. |
36 |
| - The callback functions are plain C functions and are not visible or |
37 |
| - callable at the SQL level. |
38 |
| - </para> |
39 |
| - |
40 |
| - <para> |
41 |
| - The validator function is responsible for validating options given in |
42 |
| - <command>CREATE</command> and <command>ALTER</command> commands for its |
43 |
| - foreign data wrapper, as well as foreign servers, user mappings, and |
44 |
| - foreign tables using the wrapper. |
45 |
| - The validator function must be registered as taking two arguments, a text |
46 |
| - array containing the options to be validated, and an OID representing the |
47 |
| - type of object the options are associated with (in the form of the OID |
48 |
| - of the system catalog the object would be stored in, either |
49 |
| - <literal>ForeignDataWrapperRelationId</>, |
50 |
| - <literal>ForeignServerRelationId</>, |
51 |
| - <literal>UserMappingRelationId</>, |
52 |
| - or <literal>ForeignTableRelationId</>). |
53 |
| - If no validator function is supplied, options are not checked at object |
54 |
| - creation time or object alteration time. |
55 |
| - </para> |
56 |
| - |
57 | 20 | <para>
|
58 | 21 | The foreign data wrappers included in the standard distribution are good
|
59 | 22 | references when trying to write your own. Look into the
|
|
71 | 34 | </para>
|
72 | 35 | </note>
|
73 | 36 |
|
74 |
| - <sect1 id="fdw-routines"> |
| 37 | + <sect1 id="fdw-functions"> |
| 38 | + <title>Foreign Data Wrapper Functions</title> |
| 39 | + |
| 40 | + <para> |
| 41 | + The FDW author needs to implement a handler function, and optionally |
| 42 | + a validator function. Both functions must be written in a compiled |
| 43 | + language such as C, using the version-1 interface. |
| 44 | + For details on C language calling conventions and dynamic loading, |
| 45 | + see <xref linkend="xfunc-c">. |
| 46 | + </para> |
| 47 | + |
| 48 | + <para> |
| 49 | + The handler function simply returns a struct of function pointers to |
| 50 | + callback functions that will be called by the planner and executor. |
| 51 | + Most of the effort in writing an FDW is in implementing these callback |
| 52 | + functions. |
| 53 | + The handler function must be registered with |
| 54 | + <productname>PostgreSQL</productname> as taking no arguments and |
| 55 | + returning the special pseudo-type <type>fdw_handler</type>. The |
| 56 | + callback functions are plain C functions and are not visible or |
| 57 | + callable at the SQL level. The callback functions are described in |
| 58 | + <xref linkend="fdw-callbacks">. |
| 59 | + </para> |
| 60 | + |
| 61 | + <para> |
| 62 | + The validator function is responsible for validating options given in |
| 63 | + <command>CREATE</command> and <command>ALTER</command> commands for its |
| 64 | + foreign data wrapper, as well as foreign servers, user mappings, and |
| 65 | + foreign tables using the wrapper. |
| 66 | + The validator function must be registered as taking two arguments, a |
| 67 | + text array containing the options to be validated, and an OID |
| 68 | + representing the type of object the options are associated with (in |
| 69 | + the form of the OID of the system catalog the object would be stored |
| 70 | + in, either |
| 71 | + <literal>ForeignDataWrapperRelationId</>, |
| 72 | + <literal>ForeignServerRelationId</>, |
| 73 | + <literal>UserMappingRelationId</>, |
| 74 | + or <literal>ForeignTableRelationId</>). |
| 75 | + If no validator function is supplied, options are not checked at object |
| 76 | + creation time or object alteration time. |
| 77 | + </para> |
| 78 | + |
| 79 | + </sect1> |
| 80 | + |
| 81 | + <sect1 id="fdw-callbacks"> |
75 | 82 | <title>Foreign Data Wrapper Callback Routines</title>
|
76 | 83 |
|
77 | 84 | <para>
|
|
0 commit comments