Synopsis

Use the CREATE SERVER command to create a foreign table.

Syntax

create_server ::= CREATE SERVER [ IF NOT EXISTS ] server_name  
                  [ TYPE server_type ] [ VERSION server_version ]  
                  FOREIGN DATA WRAPPER fdw_name 
                  [ OPTIONS ( fdw_options ) ]

create_server

CREATESERVERIFNOTEXISTSserver_nameTYPEserver_typeVERSIONserver_versionFOREIGNDATAWRAPPERfdw_nameOPTIONS(fdw_options)

Semantics

Create a foreign server named server_name. If server_name already exists in the specified database, an error will be raised unless the IF NOT EXISTS clause is used.

Type

The TYPE clause can be optionally used to specify the server type.

Server Version

The VERSION clause can be optionally used to specify the server version.

FDW name

The FOREIGN DATA WRAPPER clause can be used to specify the name of the foreign-data wrapper.

Options:

The OPTIONS clause specifies options for the foreign server. They typically define the connection details of the server, but the actual permitted option names and values are specific to the server’s foreign data wrapper.

Examples

Basic example.

yugabyte=#  CREATE SERVER my_server FOREIGN DATA WRAPPER my_wrapper OPTIONS (host '187.51.62.1');

See also