1CREATE FOREIGN DATA WRAPPER(7)   SQL Commands   CREATE FOREIGN DATA WRAPPER(7)
2
3
4

NAME

6       CREATE FOREIGN DATA WRAPPER - define a new foreign-data wrapper
7
8

SYNOPSIS

10       CREATE FOREIGN DATA WRAPPER name
11           [ VALIDATOR valfunction | NO VALIDATOR ]
12           [ OPTIONS ( option 'value' [, ... ] ) ]
13
14

DESCRIPTION

16       CREATE  FOREIGN  DATA  WRAPPER  creates a new foreign-data wrapper. The
17       user who defines a foreign-data wrapper becomes its owner.
18
19       The foreign-data wrapper name must be unique within the database.
20
21       Only superusers can create foreign-data wrappers.
22

PARAMETERS

24       name   The name of the foreign-data wrapper to be created.
25
26       VALIDATOR valfunction
27              valfunction is the name of a previously registered function that
28              will  be  called  to check the generic options given to the for‐
29              eign-data wrapper, as well as to foreign servers and  user  map‐
30              pings  using  the foreign-data wrapper. If no validator function
31              or NO VALIDATOR is specified, then options will not  be  checked
32              at creation time. (Foreign-data wrappers will possibly ignore or
33              reject invalid option specifications at run time,  depending  on
34              the  implementation.) The validator function must take two argu‐
35              ments: one of type text[],  which  will  contain  the  array  of
36              options  as  stored in the system catalogs, and one of type oid,
37              which will be the OID  of  the  system  catalog  containing  the
38              options.  The  return type is ignored; the function should indi‐
39              cate invalid options using the ereport() function.
40
41       OPTIONS ( option 'value' [, ... ] )
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
45              library. Option names must be unique.
46

NOTES

48       At  the moment, the foreign-data wrapper functionality is very rudimen‐
49       tary. The purpose of foreign-data wrappers, foreign servers,  and  user
50       mappings  is to store this information in a standard way so that it can
51       be queried by interested applications.  One such application is dblink;
52       see  in the documentation. The functionality to actually query external
53       data through a foreign-data wrapper library does not exist yet.
54
55       There is currently one foreign-data  wrapper  validator  function  pro‐
56       vided: postgresql_fdw_validator, which accepts options corresponding to
57       libpq connection parameters.
58

EXAMPLES

60       Create a foreign-data wrapper dummy:
61
62       CREATE FOREIGN DATA WRAPPER dummy;
63
64
65       Create a foreign-data wrapper postgresql with validator function  post‐
66       gresql_fdw_validator:
67
68       CREATE FOREIGN DATA WRAPPER postgresql VALIDATOR postgresql_fdw_validator;
69
70
71       Create a foreign-data wrapper mywrapper with some options:
72
73       CREATE FOREIGN DATA WRAPPER mywrapper
74           OPTIONS (debug 'true');
75
76

COMPATIBILITY

78       CREATE  FOREIGN DATA WRAPPER conforms to ISO/IEC 9075-9 (SQL/MED), with
79       the exception that the VALIDATOR clause is an extension and the clauses
80       LIBRARY and LANGUAGE are not yet implemented in PostgreSQL.
81
82       Note,  however,  that  the  SQL/MED functionality as a whole is not yet
83       conforming.
84

SEE ALSO

86       ALTER FOREIGN DATA WRAPPER [alter_foreign_data_wrapper(7)],  DROP  FOR‐
87       EIGN  DATA  WRAPPER [drop_foreign_data_wrapper(7)], CREATE SERVER [cre‐
88       ate_server(7)], CREATE USER MAPPING [create_user_mapping(7)]
89
90
91
92SQL - Language Statements         2011-09-22    CREATE FOREIGN DATA WRAPPER(7)
Impressum