1CREATE FOREIGN DATA WRAPPPEoRs(t7g)reSQL 9.2.24 DocumenCtRaEtAiToEnFOREIGN DATA WRAPPER(7)
2
3
4

NAME

6       CREATE_FOREIGN_DATA_WRAPPER - define a new foreign-data wrapper
7

SYNOPSIS

9       CREATE FOREIGN DATA WRAPPER name
10           [ HANDLER handler_function | NO HANDLER ]
11           [ VALIDATOR validator_function | NO VALIDATOR ]
12           [ OPTIONS ( option 'value' [, ... ] ) ]
13

DESCRIPTION

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

PARAMETERS

23       name
24           The name of the foreign-data wrapper to be created.
25
26       HANDLER handler_function
27           handler_function is the name of a previously registered function
28           that will be called to retrieve the execution functions for foreign
29           tables. The handler function must take no arguments, and its return
30           type must be fdw_handler.
31
32           It is possible to create a foreign-data wrapper with no handler
33           function, but foreign tables using such a wrapper can only be
34           declared, not accessed.
35
36       VALIDATOR validator_function
37           validator_function is the name of a previously registered function
38           that will be called to check the generic options given to the
39           foreign-data wrapper, as well as options for foreign servers and
40           user mappings using the foreign-data wrapper. If no validator
41           function or NO VALIDATOR is specified, then options will not be
42           checked at creation time. (Foreign-data wrappers will possibly
43           ignore or reject invalid option specifications at run time,
44           depending on the implementation.) The validator function must take
45           two arguments: one of type text[], which will contain the array of
46           options as stored in the system catalogs, and one of type oid,
47           which will be the OID of the system catalog containing the options.
48           The return type is ignored; the function should report invalid
49           options using the ereport(ERROR) function.
50
51       OPTIONS ( option 'value' [, ... ] )
52           This clause specifies options for the new foreign-data wrapper. The
53           allowed option names and values are specific to each foreign data
54           wrapper and are validated using the foreign-data wrapper's
55           validator function. Option names must be unique.
56

NOTES

58       At the moment, the foreign-data wrapper functionality is rudimentary.
59       There is no support for updating a foreign table, and optimization of
60       queries is primitive (and mostly left to the wrapper, too).
61
62       There is one built-in foreign-data wrapper validator function provided:
63       postgresql_fdw_validator, which accepts options corresponding to libpq
64       connection parameters.
65

EXAMPLES

67       Create a useless foreign-data wrapper dummy:
68
69           CREATE FOREIGN DATA WRAPPER dummy;
70
71       Create a foreign-data wrapper file with handler function
72       file_fdw_handler:
73
74           CREATE FOREIGN DATA WRAPPER file HANDLER file_fdw_handler;
75
76       Create a foreign-data wrapper mywrapper with some options:
77
78           CREATE FOREIGN DATA WRAPPER mywrapper
79               OPTIONS (debug 'true');
80

COMPATIBILITY

82       CREATE FOREIGN DATA WRAPPER conforms to ISO/IEC 9075-9 (SQL/MED), with
83       the exception that the HANDLER and VALIDATOR clauses are extensions and
84       the standard clauses LIBRARY and LANGUAGE are not implemented in
85       PostgreSQL.
86
87       Note, however, that the SQL/MED functionality as a whole is not yet
88       conforming.
89

SEE ALSO

91       ALTER FOREIGN DATA WRAPPER (ALTER_FOREIGN_DATA_WRAPPER(7)), DROP
92       FOREIGN DATA WRAPPER (DROP_FOREIGN_DATA_WRAPPER(7)), CREATE SERVER
93       (CREATE_SERVER(7)), CREATE USER MAPPING (CREATE_USER_MAPPING(7))
94
95
96
97PostgreSQL 9.2.24                 2017-11-06    CREATE FOREIGN DATA WRAPPER(7)
Impressum