gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 line
5.2KB

  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>5.12. Foreign Data</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="ddl-partitioning.html" title="5.11. Table Partitioning" /><link rel="next" href="ddl-others.html" title="5.13. Other Database Objects" /></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">5.12. Foreign Data</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="ddl-partitioning.html" title="5.11. Table Partitioning">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="ddl.html" title="Chapter 5. Data Definition">Up</a></td><th width="60%" align="center">Chapter 5. Data Definition</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="ddl-others.html" title="5.13. Other Database Objects">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="DDL-FOREIGN-DATA"><div class="titlepage"><div><div><h2 class="title" style="clear: both">5.12. Foreign Data</h2></div></div></div><a id="id-1.5.4.14.2" class="indexterm"></a><a id="id-1.5.4.14.3" class="indexterm"></a><a id="id-1.5.4.14.4" class="indexterm"></a><p>
  3. <span class="productname">PostgreSQL</span> implements portions of the SQL/MED
  4. specification, allowing you to access data that resides outside
  5. PostgreSQL using regular SQL queries. Such data is referred to as
  6. <em class="firstterm">foreign data</em>. (Note that this usage is not to be confused
  7. with foreign keys, which are a type of constraint within the database.)
  8. </p><p>
  9. Foreign data is accessed with help from a
  10. <em class="firstterm">foreign data wrapper</em>. A foreign data wrapper is a
  11. library that can communicate with an external data source, hiding the
  12. details of connecting to the data source and obtaining data from it.
  13. There are some foreign data wrappers available as <code class="filename">contrib</code>
  14. modules; see <a class="xref" href="contrib.html" title="Appendix F. Additional Supplied Modules">Appendix F</a>. Other kinds of foreign data
  15. wrappers might be found as third party products. If none of the existing
  16. foreign data wrappers suit your needs, you can write your own; see <a class="xref" href="fdwhandler.html" title="Chapter 56. Writing a Foreign Data Wrapper">Chapter 56</a>.
  17. </p><p>
  18. To access foreign data, you need to create a <em class="firstterm">foreign server</em>
  19. object, which defines how to connect to a particular external data source
  20. according to the set of options used by its supporting foreign data
  21. wrapper. Then you need to create one or more <em class="firstterm">foreign
  22. tables</em>, which define the structure of the remote data. A
  23. foreign table can be used in queries just like a normal table, but a
  24. foreign table has no storage in the PostgreSQL server. Whenever it is
  25. used, <span class="productname">PostgreSQL</span> asks the foreign data wrapper
  26. to fetch data from the external source, or transmit data to the external
  27. source in the case of update commands.
  28. </p><p>
  29. Accessing remote data may require authenticating to the external
  30. data source. This information can be provided by a
  31. <em class="firstterm">user mapping</em>, which can provide additional data
  32. such as user names and passwords based
  33. on the current <span class="productname">PostgreSQL</span> role.
  34. </p><p>
  35. For additional information, see
  36. <a class="xref" href="sql-createforeigndatawrapper.html" title="CREATE FOREIGN DATA WRAPPER"><span class="refentrytitle">CREATE FOREIGN DATA WRAPPER</span></a>,
  37. <a class="xref" href="sql-createserver.html" title="CREATE SERVER"><span class="refentrytitle">CREATE SERVER</span></a>,
  38. <a class="xref" href="sql-createusermapping.html" title="CREATE USER MAPPING"><span class="refentrytitle">CREATE USER MAPPING</span></a>,
  39. <a class="xref" href="sql-createforeigntable.html" title="CREATE FOREIGN TABLE"><span class="refentrytitle">CREATE FOREIGN TABLE</span></a>, and
  40. <a class="xref" href="sql-importforeignschema.html" title="IMPORT FOREIGN SCHEMA"><span class="refentrytitle">IMPORT FOREIGN SCHEMA</span></a>.
  41. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ddl-partitioning.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ddl.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ddl-others.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">5.11. Table Partitioning </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 5.13. Other Database Objects</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1