1CREATE SERVER(7)                 SQL Commands                 CREATE SERVER(7)
2
3
4

NAME

6       CREATE SERVER - define a new foreign server
7
8

SYNOPSIS

10       CREATE SERVER servername [ TYPE 'servertype' ] [ VERSION 'serverversion' ]
11           FOREIGN DATA WRAPPER fdwname
12           [ OPTIONS ( option 'value' [, ... ] ) ]
13
14

DESCRIPTION

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

PARAMETERS

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

NOTES

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

EXAMPLES

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

COMPATIBILITY

68       CREATE SERVER conforms to ISO/IEC 9075-9 (SQL/MED).
69

SEE ALSO

71       ALTER SERVER [alter_server(7)], DROP  SERVER  [drop_server(7)],  CREATE
72       FOREIGN DATA WRAPPER [create_foreign_data_wrapper(7)], CREATE USER MAP‐
73       PING [create_user_mapping(7)]
74
75
76
77SQL - Language Statements         2011-09-22                  CREATE SERVER(7)
Impressum