gooderp18绿色标准版
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

77 rindas
8.1KB

  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>CREATE FOREIGN DATA WRAPPER</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="sql-createextension.html" title="CREATE EXTENSION" /><link rel="next" href="sql-createforeigntable.html" title="CREATE FOREIGN TABLE" /></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">CREATE FOREIGN DATA WRAPPER</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-createextension.html" title="CREATE EXTENSION">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</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="sql-createforeigntable.html" title="CREATE FOREIGN TABLE">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="SQL-CREATEFOREIGNDATAWRAPPER"><div class="titlepage"></div><a id="id-1.9.3.65.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">CREATE FOREIGN DATA WRAPPER</span></h2><p>CREATE FOREIGN DATA WRAPPER — define a new foreign-data wrapper</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
  3. CREATE FOREIGN DATA WRAPPER <em class="replaceable"><code>name</code></em>
  4. [ HANDLER <em class="replaceable"><code>handler_function</code></em> | NO HANDLER ]
  5. [ VALIDATOR <em class="replaceable"><code>validator_function</code></em> | NO VALIDATOR ]
  6. [ OPTIONS ( <em class="replaceable"><code>option</code></em> '<em class="replaceable"><code>value</code></em>' [, ... ] ) ]
  7. </pre></div><div class="refsect1" id="id-1.9.3.65.5"><h2>Description</h2><p>
  8. <code class="command">CREATE FOREIGN DATA WRAPPER</code> creates a new
  9. foreign-data wrapper. The user who defines a foreign-data wrapper
  10. becomes its owner.
  11. </p><p>
  12. The foreign-data wrapper name must be unique within the database.
  13. </p><p>
  14. Only superusers can create foreign-data wrappers.
  15. </p></div><div class="refsect1" id="id-1.9.3.65.6"><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd><p>
  16. The name of the foreign-data wrapper to be created.
  17. </p></dd><dt><span class="term"><code class="literal">HANDLER <em class="replaceable"><code>handler_function</code></em></code></span></dt><dd><p><em class="replaceable"><code>handler_function</code></em> is the
  18. name of a previously registered function that will be called to
  19. retrieve the execution functions for foreign tables.
  20. The handler function must take no arguments, and
  21. its return type must be <code class="type">fdw_handler</code>.
  22. </p><p>
  23. It is possible to create a foreign-data wrapper with no handler
  24. function, but foreign tables using such a wrapper can only be declared,
  25. not accessed.
  26. </p></dd><dt><span class="term"><code class="literal">VALIDATOR <em class="replaceable"><code>validator_function</code></em></code></span></dt><dd><p><em class="replaceable"><code>validator_function</code></em>
  27. is the name of a previously registered function that will be called to
  28. check the generic options given to the foreign-data wrapper, as
  29. well as options for foreign servers, user mappings and foreign tables
  30. using the foreign-data wrapper. If no validator function or <code class="literal">NO
  31. VALIDATOR</code> is specified, then options will not be
  32. checked at creation time. (Foreign-data wrappers will possibly
  33. ignore or reject invalid option specifications at run time,
  34. depending on the implementation.) The validator function must
  35. take two arguments: one of type <code class="type">text[]</code>, which will
  36. contain the array of options as stored in the system catalogs,
  37. and one of type <code class="type">oid</code>, which will be the OID of the
  38. system catalog containing the options. The return type is ignored;
  39. the function should report invalid options using the
  40. <code class="function">ereport(ERROR)</code> function.
  41. </p></dd><dt><span class="term"><code class="literal">OPTIONS ( <em class="replaceable"><code>option</code></em> '<em class="replaceable"><code>value</code></em>' [, ... ] )</code></span></dt><dd><p>
  42. This clause specifies options for the new foreign-data wrapper.
  43. The allowed option names and values are specific to each foreign
  44. data wrapper and are validated using the foreign-data wrapper's
  45. validator function. Option names must be unique.
  46. </p></dd></dl></div></div><div class="refsect1" id="id-1.9.3.65.7"><h2>Notes</h2><p>
  47. <span class="productname">PostgreSQL</span>'s foreign-data functionality is still under
  48. active development. Optimization of queries is primitive (and mostly left
  49. to the wrapper, too). Thus, there is considerable room for future
  50. performance improvements.
  51. </p></div><div class="refsect1" id="id-1.9.3.65.8"><h2>Examples</h2><p>
  52. Create a useless foreign-data wrapper <code class="literal">dummy</code>:
  53. </p><pre class="programlisting">
  54. CREATE FOREIGN DATA WRAPPER dummy;
  55. </pre><p>
  56. </p><p>
  57. Create a foreign-data wrapper <code class="literal">file</code> with
  58. handler function <code class="literal">file_fdw_handler</code>:
  59. </p><pre class="programlisting">
  60. CREATE FOREIGN DATA WRAPPER file HANDLER file_fdw_handler;
  61. </pre><p>
  62. </p><p>
  63. Create a foreign-data wrapper <code class="literal">mywrapper</code> with some
  64. options:
  65. </p><pre class="programlisting">
  66. CREATE FOREIGN DATA WRAPPER mywrapper
  67. OPTIONS (debug 'true');
  68. </pre></div><div class="refsect1" id="id-1.9.3.65.9"><h2>Compatibility</h2><p>
  69. <code class="command">CREATE FOREIGN DATA WRAPPER</code> conforms to ISO/IEC
  70. 9075-9 (SQL/MED), with the exception that the <code class="literal">HANDLER</code>
  71. and <code class="literal">VALIDATOR</code> clauses are extensions and the standard
  72. clauses <code class="literal">LIBRARY</code> and <code class="literal">LANGUAGE</code>
  73. are not implemented in <span class="productname">PostgreSQL</span>.
  74. </p><p>
  75. Note, however, that the SQL/MED functionality as a whole is not yet
  76. conforming.
  77. </p></div><div class="refsect1" id="id-1.9.3.65.10"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-alterforeigndatawrapper.html" title="ALTER FOREIGN DATA WRAPPER"><span class="refentrytitle">ALTER FOREIGN DATA WRAPPER</span></a>, <a class="xref" href="sql-dropforeigndatawrapper.html" title="DROP FOREIGN DATA WRAPPER"><span class="refentrytitle">DROP FOREIGN DATA WRAPPER</span></a>, <a class="xref" href="sql-createserver.html" title="CREATE SERVER"><span class="refentrytitle">CREATE SERVER</span></a>, <a class="xref" href="sql-createusermapping.html" title="CREATE USER MAPPING"><span class="refentrytitle">CREATE USER MAPPING</span></a>, <a class="xref" href="sql-createforeigntable.html" title="CREATE FOREIGN TABLE"><span class="refentrytitle">CREATE FOREIGN TABLE</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-createextension.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-createforeigntable.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">CREATE EXTENSION </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> CREATE FOREIGN TABLE</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1