Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
IMPORT FOREIGN SCHEMA
Prev UpSQL CommandsHome Next

IMPORT FOREIGN SCHEMA

IMPORT FOREIGN SCHEMA — import table definitions from a foreign server

Synopsis

IMPORT FOREIGN SCHEMAremote_schema    [ { LIMIT TO | EXCEPT } (table_name [, ...] ) ]    FROM SERVERserver_name    INTOlocal_schema    [ OPTIONS (option 'value' [, ... ] ) ]

Description

IMPORT FOREIGN SCHEMA creates foreign tables that represent tables existing on a foreign server. The new foreign tables will be owned by the user issuing the command and are created with the correct column definitions and options to match the remote tables.

By default, all tables and views existing in a particular schema on the foreign server are imported. Optionally, the list of tables can be limited to a specified subset, or specific tables can be excluded. The new foreign tables are all created in the target schema, which must already exist.

To useIMPORT FOREIGN SCHEMA, the user must haveUSAGE privilege on the foreign server, as well asCREATE privilege on the target schema.

Parameters

remote_schema

The remote schema to import from. The specific meaning of a remote schema depends on the foreign data wrapper in use.

LIMIT TO (table_name [, ...] )

Import only foreign tables matching one of the given table names. Other tables existing in the foreign schema will be ignored.

EXCEPT (table_name [, ...] )

Exclude specified foreign tables from the import. All tables existing in the foreign schema will be imported except the ones listed here.

server_name

The foreign server to import from.

local_schema

The schema in which the imported foreign tables will be created.

OPTIONS (option 'value' [, ...] )

Options to be used during the import. The allowed option names and values are specific to each foreign data wrapper.

Examples

Import table definitions from a remote schemaforeign_films on serverfilm_server, creating the foreign tables in local schemafilms:

IMPORT FOREIGN SCHEMA foreign_films    FROM SERVER film_server INTO films;

As above, but import only the two tablesactors anddirectors (if they exist):

IMPORT FOREIGN SCHEMA foreign_films LIMIT TO (actors, directors)    FROM SERVER film_server INTO films;

Compatibility

TheIMPORT FOREIGN SCHEMA command conforms to theSQL standard, except that theOPTIONS clause is aPostgreSQL extension.


Prev Up Next
GRANT Home INSERT
pdfepub
Go to PostgreSQL 17
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp