バージョンごとのドキュメント一覧

CREATE SERVER

CREATE SERVER <refpurpose>define a new foreign server</refpurpose> — 新しい外部サーバを定義する

概要

CREATE SERVER [ IF NOT EXISTS ] server_name [ TYPE 'server_type' ] [ VERSION 'server_version' ]
    FOREIGN DATA WRAPPER fdw_name
    [ OPTIONS ( option 'value' [, ... ] ) ]

説明

<title>Description</title>

<command>CREATE SERVER</command> defines a new foreign server. The user who defines the server becomes its owner. CREATE SERVERは新しい外部サーバを定義します。 サーバを定義したユーザがその所有者となります。

A foreign server typically encapsulates connection information that a foreign-data wrapper uses to access an external data resource. Additional user-specific connection information may be specified by means of user mappings. 外部サーバは通常、外部データラッパーが外部データリソースにアクセスするために使用する接続情報をカプセル化します。 さらに、ユーザマップによりユーザ指定の接続情報が指定される可能性があります。

The server name must be unique within the database. サーバ名はデータベース内で一意でなければなりません。

Creating a server requires <literal>USAGE</literal> privilege on the foreign-data wrapper being used. サーバを作成するには、使用する外部データラッパー上にUSAGE権限が必要です。

パラメータ

<title>Parameters</title>
IF NOT EXISTS

Do not throw an error if a server with the same name already exists. A notice is issued in this case. Note that there is no guarantee that the existing server is anything like the one that would have been created. 同じ名前のサーバが既に存在する時にエラーを発生させません。 この場合、注意メッセージが発行されます。 既存のサーバが、作成されようとしていたものと類似したものであるかどうか、全く保証されないことに注意してください。

server_name

The name of the foreign server to be created. 作成する外部サーバの名前です。

server_type

Optional server type, potentially useful to foreign-data wrappers. サーバの種類(省略可能)です。 外部データラッパーで有用かもしれません。

server_version

Optional server version, potentially useful to foreign-data wrappers. サーババージョン(省略可能)です。 外部データラッパーで有用かもしれません。

fdw_name

The name of the foreign-data wrapper that manages the server. このサーバを管理する外部データラッパーの名前です。

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

This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper. この句はサーバのオプションを指定します。 オプションは通常、サーバの接続の詳細を定義しますが、実際の名前とその値はサーバの外部データラッパーに依存します。

注釈

<title>Notes</title>

When using the <xref linkend="dblink"/> module, a foreign server's name can be used as an argument of the <xref linkend="contrib-dblink-connect"/> function to indicate the connection parameters. It is necessary to have the <literal>USAGE</literal> privilege on the foreign server to be able to use it in this way. dblinkモジュールを使用している場合、接続パラメータを表すために、外部サーバ名をdblink_connect関数の引数として使用することができます。 この方法で利用できるようにするためには外部サーバ上にUSAGE権限が必要です。

<title>Examples</title>

Create a server <literal>myserver</literal> that uses the foreign-data wrapper <literal>postgres_fdw</literal>: 外部データラッパーpostgres_fdwを使用するmyserverサーバを作成します。

CREATE SERVER myserver FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'foo', dbname 'foodb', port '5432');

See <xref linkend="postgres-fdw"/> for more details. 詳細についてはpostgres_fdwを参照してください。

互換性

<title>Compatibility</title>

<command>CREATE SERVER</command> conforms to ISO/IEC 9075-9 (SQL/MED). CREATE SERVERはISO/IEC 9075-9 (SQL/MED)に従います。

関連項目

<title>See Also</title> ALTER SERVER, DROP SERVER, CREATE FOREIGN DATA WRAPPER, CREATE FOREIGN TABLE, CREATE USER MAPPING