1CREATE SERVER(7)        PostgreSQL 9.2.24 Documentation       CREATE SERVER(7)
2
3
4

NAME

6       CREATE_SERVER - define a new foreign server
7

SYNOPSIS

9       CREATE SERVER server_name [ TYPE 'server_type' ] [ VERSION 'server_version' ]
10           FOREIGN DATA WRAPPER fdw_name
11           [ OPTIONS ( option 'value' [, ... ] ) ]
12

DESCRIPTION

14       CREATE SERVER defines a new foreign server. The user who defines the
15       server becomes its owner.
16
17       A foreign server typically encapsulates connection information that a
18       foreign-data wrapper uses to access an external data resource.
19       Additional user-specific connection information may be specified by
20       means of user mappings.
21
22       The server name must be unique within the database.
23
24       Creating a server requires USAGE privilege on the foreign-data wrapper
25       being used.
26

PARAMETERS

28       server_name
29           The name of the foreign server to be created.
30
31       server_type
32           Optional server type.
33
34       server_version
35           Optional server version.
36
37       fdw_name
38           The name of the foreign-data wrapper that manages the server.
39
40       OPTIONS ( option 'value' [, ... ] )
41           This clause specifies the options for the server. The options
42           typically define the connection details of the server, but the
43           actual names and values are dependent on the server's foreign-data
44           wrapper.
45

NOTES

47       When using the dblink module (see dblink), the foreign server name can
48       be used as an argument of the dblink_connect(3) function to indicate
49       the connection parameters. See also there for more examples. It is
50       necessary to have the USAGE privilege on the foreign server to be able
51       to use it in this way.
52

EXAMPLES

54       Create a server foo that uses the built-in foreign-data wrapper
55       default:
56
57           CREATE SERVER foo FOREIGN DATA WRAPPER "default";
58
59       Create a server myserver that uses the foreign-data wrapper pgsql:
60
61           CREATE SERVER myserver FOREIGN DATA WRAPPER pgsql OPTIONS (host 'foo', dbname 'foodb', port '5432');
62

COMPATIBILITY

64       CREATE SERVER conforms to ISO/IEC 9075-9 (SQL/MED).
65

SEE ALSO

67       ALTER SERVER (ALTER_SERVER(7)), DROP SERVER (DROP_SERVER(7)), CREATE
68       FOREIGN DATA WRAPPER (CREATE_FOREIGN_DATA_WRAPPER(7)), CREATE USER
69       MAPPING (CREATE_USER_MAPPING(7))
70
71
72
73PostgreSQL 9.2.24                 2017-11-06                  CREATE SERVER(7)
Impressum