gooderp18绿色标准版
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

36 行
4.4KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>56.1. Foreign Data Wrapper Functions</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="fdwhandler.html" title="Chapter 56. Writing a Foreign Data Wrapper" /><link rel="next" href="fdw-callbacks.html" title="56.2. Foreign Data Wrapper Callback Routines" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">56.1. Foreign Data Wrapper Functions</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="fdwhandler.html" title="Chapter 56. Writing a Foreign Data Wrapper">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="fdwhandler.html" title="Chapter 56. Writing a Foreign Data Wrapper">Up</a></td><th width="60%" align="center">Chapter 56. Writing a Foreign Data Wrapper</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="fdw-callbacks.html" title="56.2. Foreign Data Wrapper Callback Routines">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="FDW-FUNCTIONS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">56.1. Foreign Data Wrapper Functions</h2></div></div></div><p>
  3. The FDW author needs to implement a handler function, and optionally
  4. a validator function. Both functions must be written in a compiled
  5. language such as C, using the version-1 interface.
  6. For details on C language calling conventions and dynamic loading,
  7. see <a class="xref" href="xfunc-c.html" title="37.10. C-Language Functions">Section 37.10</a>.
  8. </p><p>
  9. The handler function simply returns a struct of function pointers to
  10. callback functions that will be called by the planner, executor, and
  11. various maintenance commands.
  12. Most of the effort in writing an FDW is in implementing these callback
  13. functions.
  14. The handler function must be registered with
  15. <span class="productname">PostgreSQL</span> as taking no arguments and
  16. returning the special pseudo-type <code class="type">fdw_handler</code>. The
  17. callback functions are plain C functions and are not visible or
  18. callable at the SQL level. The callback functions are described in
  19. <a class="xref" href="fdw-callbacks.html" title="56.2. Foreign Data Wrapper Callback Routines">Section 56.2</a>.
  20. </p><p>
  21. The validator function is responsible for validating options given in
  22. <code class="command">CREATE</code> and <code class="command">ALTER</code> commands for its
  23. foreign data wrapper, as well as foreign servers, user mappings, and
  24. foreign tables using the wrapper.
  25. The validator function must be registered as taking two arguments, a
  26. text array containing the options to be validated, and an OID
  27. representing the type of object the options are associated with (in
  28. the form of the OID of the system catalog the object would be stored
  29. in, either
  30. <code class="literal">ForeignDataWrapperRelationId</code>,
  31. <code class="literal">ForeignServerRelationId</code>,
  32. <code class="literal">UserMappingRelationId</code>,
  33. or <code class="literal">ForeignTableRelationId</code>).
  34. If no validator function is supplied, options are not checked at object
  35. creation time or object alteration time.
  36. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="fdwhandler.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="fdwhandler.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="fdw-callbacks.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 56. Writing a Foreign Data Wrapper </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 56.2. Foreign Data Wrapper Callback Routines</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1