Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > fc62ce67f262cdcd253dc7f849ce3223 > files > 810

postgresql8.4-docs-8.4.12-0.1mdv2010.2.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>CREATE FOREIGN DATA WRAPPER</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 8.4.12 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SQL Commands"
HREF="sql-commands.html"><LINK
REL="PREVIOUS"
TITLE="CREATE DOMAIN"
HREF="sql-createdomain.html"><LINK
REL="NEXT"
TITLE="CREATE FUNCTION"
HREF="sql-createfunction.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2012-05-31T23:30:11"></HEAD
><BODY
CLASS="REFENTRY"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="5"
ALIGN="center"
VALIGN="bottom"
>PostgreSQL 8.4.12 Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="sql-createdomain.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="sql-createdomain.html"
>Fast Backward</A
></TD
><TD
WIDTH="60%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="sql-createfunction.html"
>Fast Forward</A
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="sql-createfunction.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SQL-CREATEFOREIGNDATAWRAPPER"
></A
>CREATE FOREIGN DATA WRAPPER</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN56787"
></A
><H2
>Name</H2
>CREATE FOREIGN DATA WRAPPER&nbsp;--&nbsp;define a new foreign-data wrapper</DIV
><A
NAME="AEN56790"
></A
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN56792"
></A
><H2
>Synopsis</H2
><PRE
CLASS="SYNOPSIS"
>CREATE FOREIGN DATA WRAPPER <TT
CLASS="REPLACEABLE"
><I
>name</I
></TT
>
    [ VALIDATOR <TT
CLASS="REPLACEABLE"
><I
>valfunction</I
></TT
> | NO VALIDATOR ]
    [ OPTIONS ( <TT
CLASS="REPLACEABLE"
><I
>option</I
></TT
> '<TT
CLASS="REPLACEABLE"
><I
>value</I
></TT
>' [, ... ] ) ]</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN56798"
></A
><H2
>Description</H2
><P
>   <TT
CLASS="COMMAND"
>CREATE FOREIGN DATA WRAPPER</TT
> creates a new
   foreign-data wrapper.  The user who defines a foreign-data wrapper
   becomes its owner.
  </P
><P
>   The foreign-data wrapper name must be unique within the database.
  </P
><P
>   Only superusers can create foreign-data wrappers.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN56804"
></A
><H2
>Parameters</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="REPLACEABLE"
><I
>name</I
></TT
></DT
><DD
><P
>      The name of the foreign-data wrapper to be created.
     </P
></DD
><DT
><TT
CLASS="LITERAL"
>VALIDATOR <TT
CLASS="REPLACEABLE"
><I
>valfunction</I
></TT
></TT
></DT
><DD
><P
>      <TT
CLASS="REPLACEABLE"
><I
>valfunction</I
></TT
> is the
      name of a previously registered function that will be called to
      check the generic options given to the foreign-data wrapper, as
      well as to foreign servers and user mappings using the
      foreign-data wrapper.  If no validator function or <TT
CLASS="LITERAL"
>NO
      VALIDATOR</TT
> is specified, then options will not be
      checked at creation time.  (Foreign-data wrappers will possibly
      ignore or reject invalid option specifications at run time,
      depending on the implementation.)  The validator function must
      take two arguments: one of type <TT
CLASS="TYPE"
>text[]</TT
>, which will
      contain the array of options as stored in the system catalogs,
      and one of type <TT
CLASS="TYPE"
>oid</TT
>, which will be the OID of the
      system catalog containing the options. The return type is ignored;
      the function should indicate invalid options using the
      <CODE
CLASS="FUNCTION"
>ereport()</CODE
> function.
     </P
></DD
><DT
><TT
CLASS="LITERAL"
>OPTIONS ( <TT
CLASS="REPLACEABLE"
><I
>option</I
></TT
> '<TT
CLASS="REPLACEABLE"
><I
>value</I
></TT
>' [, ... ] )</TT
></DT
><DD
><P
>      This clause specifies options for the new foreign-data wrapper.
      The allowed option names and values are specific to each foreign
      data wrapper and are validated using the foreign-data wrapper
      library.  Option names must be unique.
     </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN56830"
></A
><H2
>Notes</H2
><P
>   At the moment, the foreign-data wrapper functionality is very
   rudimentary.  The purpose of foreign-data wrappers, foreign
   servers, and user mappings is to store this information in a
   standard way so that it can be queried by interested applications.
   One such application is <SPAN
CLASS="APPLICATION"
>dblink</SPAN
>;
   see <A
HREF="dblink.html"
>Section F.8</A
>.  The functionality to actually query
   external data through a foreign-data wrapper library does not exist
   yet.
  </P
><P
>   There is currently one foreign-data wrapper validator function
   provided:
   <TT
CLASS="FILENAME"
>postgresql_fdw_validator</TT
>, which accepts
   options corresponding to <SPAN
CLASS="APPLICATION"
>libpq</SPAN
> connection
   parameters.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN56838"
></A
><H2
>Examples</H2
><P
>   Create a foreign-data wrapper <TT
CLASS="LITERAL"
>dummy</TT
>:
</P><PRE
CLASS="PROGRAMLISTING"
>CREATE FOREIGN DATA WRAPPER dummy;</PRE
><P>
  </P
><P
>   Create a foreign-data wrapper <TT
CLASS="LITERAL"
>postgresql</TT
> with
   validator function <TT
CLASS="LITERAL"
>postgresql_fdw_validator</TT
>:
</P><PRE
CLASS="PROGRAMLISTING"
>CREATE FOREIGN DATA WRAPPER postgresql VALIDATOR postgresql_fdw_validator;</PRE
><P>
  </P
><P
>   Create a foreign-data wrapper <TT
CLASS="LITERAL"
>mywrapper</TT
> with some
   options:
</P><PRE
CLASS="PROGRAMLISTING"
>CREATE FOREIGN DATA WRAPPER mywrapper
    OPTIONS (debug 'true');</PRE
><P>
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN56850"
></A
><H2
>Compatibility</H2
><P
>   <TT
CLASS="COMMAND"
>CREATE FOREIGN DATA WRAPPER</TT
> conforms to ISO/IEC
   9075-9 (SQL/MED), with the exception that
   the <TT
CLASS="LITERAL"
>VALIDATOR</TT
> clause is an extension and the
   clauses <TT
CLASS="LITERAL"
>LIBRARY</TT
> and <TT
CLASS="LITERAL"
>LANGUAGE</TT
>
   are not yet implemented in PostgreSQL.
  </P
><P
>   Note, however, that the SQL/MED functionality as a whole is not yet
   conforming.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN56858"
></A
><H2
>See Also</H2
><A
HREF="sql-alterforeigndatawrapper.html"
><I
>ALTER FOREIGN DATA WRAPPER</I
></A
>, <A
HREF="sql-dropforeigndatawrapper.html"
><I
>DROP FOREIGN DATA WRAPPER</I
></A
>, <A
HREF="sql-createserver.html"
><I
>CREATE SERVER</I
></A
>, <A
HREF="sql-createusermapping.html"
><I
>CREATE USER MAPPING</I
></A
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sql-createdomain.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sql-createfunction.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>CREATE DOMAIN</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="sql-commands.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>CREATE FUNCTION</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>