1IMPORT FOREIGN SCHEMA(7) PostgreSQL 13.3 DocumentationIMPORT FOREIGN SCHEMA(7)
2
3
4

NAME

6       IMPORT_FOREIGN_SCHEMA - import table definitions from a foreign server
7

SYNOPSIS

9       IMPORT FOREIGN SCHEMA remote_schema
10           [ { LIMIT TO | EXCEPT } ( table_name [, ...] ) ]
11           FROM SERVER server_name
12           INTO local_schema
13           [ OPTIONS ( option 'value' [, ... ] ) ]
14

DESCRIPTION

16       IMPORT FOREIGN SCHEMA creates foreign tables that represent tables
17       existing on a foreign server. The new foreign tables will be owned by
18       the user issuing the command and are created with the correct column
19       definitions and options to match the remote tables.
20
21       By default, all tables and views existing in a particular schema on the
22       foreign server are imported. Optionally, the list of tables can be
23       limited to a specified subset, or specific tables can be excluded. The
24       new foreign tables are all created in the target schema, which must
25       already exist.
26
27       To use IMPORT FOREIGN SCHEMA, the user must have USAGE privilege on the
28       foreign server, as well as CREATE privilege on the target schema.
29

PARAMETERS

31       remote_schema
32           The remote schema to import from. The specific meaning of a remote
33           schema depends on the foreign data wrapper in use.
34
35       LIMIT TO ( table_name [, ...] )
36           Import only foreign tables matching one of the given table names.
37           Other tables existing in the foreign schema will be ignored.
38
39       EXCEPT ( table_name [, ...] )
40           Exclude specified foreign tables from the import. All tables
41           existing in the foreign schema will be imported except the ones
42           listed here.
43
44       server_name
45           The foreign server to import from.
46
47       local_schema
48           The schema in which the imported foreign tables will be created.
49
50       OPTIONS ( option 'value' [, ...] )
51           Options to be used during the import. The allowed option names and
52           values are specific to each foreign data wrapper.
53

EXAMPLES

55       Import table definitions from a remote schema foreign_films on server
56       film_server, creating the foreign tables in local schema films:
57
58           IMPORT FOREIGN SCHEMA foreign_films
59               FROM SERVER film_server INTO films;
60
61       As above, but import only the two tables actors and directors (if they
62       exist):
63
64           IMPORT FOREIGN SCHEMA foreign_films LIMIT TO (actors, directors)
65               FROM SERVER film_server INTO films;
66

COMPATIBILITY

68       The IMPORT FOREIGN SCHEMA command conforms to the SQL standard, except
69       that the OPTIONS clause is a PostgreSQL extension.
70

SEE ALSO

72       CREATE FOREIGN TABLE (CREATE_FOREIGN_TABLE(7)), CREATE SERVER
73       (CREATE_SERVER(7))
74
75
76
77PostgreSQL 13.3                      2021             IMPORT FOREIGN SCHEMA(7)
Impressum