]> begriffs open source - ai-pg/blob - full-docs/man7/CREATE_SERVER.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / CREATE_SERVER.7
1 '\" t
2 .\"     Title: CREATE SERVER
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "CREATE SERVER" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 CREATE_SERVER \- define a new foreign server
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 CREATE SERVER [ IF NOT EXISTS ] \fIserver_name\fR [ TYPE \*(Aq\fIserver_type\fR\*(Aq ] [ VERSION \*(Aq\fIserver_version\fR\*(Aq ]
36     FOREIGN DATA WRAPPER \fIfdw_name\fR
37     [ OPTIONS ( \fIoption\fR \*(Aq\fIvalue\fR\*(Aq [, \&.\&.\&. ] ) ]
38 .fi
39 .SH "DESCRIPTION"
40 .PP
41 \fBCREATE SERVER\fR
42 defines a new foreign server\&. The user who defines the server becomes its owner\&.
43 .PP
44 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\&.
45 .PP
46 The server name must be unique within the database\&.
47 .PP
48 Creating a server requires
49 USAGE
50 privilege on the foreign\-data wrapper being used\&.
51 .SH "PARAMETERS"
52 .PP
53 IF NOT EXISTS
54 .RS 4
55 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\&.
56 .RE
57 .PP
58 \fIserver_name\fR
59 .RS 4
60 The name of the foreign server to be created\&.
61 .RE
62 .PP
63 \fIserver_type\fR
64 .RS 4
65 Optional server type, potentially useful to foreign\-data wrappers\&.
66 .RE
67 .PP
68 \fIserver_version\fR
69 .RS 4
70 Optional server version, potentially useful to foreign\-data wrappers\&.
71 .RE
72 .PP
73 \fIfdw_name\fR
74 .RS 4
75 The name of the foreign\-data wrapper that manages the server\&.
76 .RE
77 .PP
78 OPTIONS ( \fIoption\fR \*(Aq\fIvalue\fR\*(Aq [, \&.\&.\&. ] )
79 .RS 4
80 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\*(Aqs foreign\-data wrapper\&.
81 .RE
82 .SH "NOTES"
83 .PP
84 When using the
85 dblink
86 module, a foreign server\*(Aqs name can be used as an argument of the
87 \fBdblink_connect\fR(3)
88 function to indicate the connection parameters\&. It is necessary to have the
89 USAGE
90 privilege on the foreign server to be able to use it in this way\&.
91 .PP
92 If the foreign server supports sort pushdown, it is necessary for it to have the same sort ordering as the local server\&.
93 .SH "EXAMPLES"
94 .PP
95 Create a server
96 myserver
97 that uses the foreign\-data wrapper
98 postgres_fdw:
99 .sp
100 .if n \{\
101 .RS 4
102 .\}
103 .nf
104 CREATE SERVER myserver FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host \*(Aqfoo\*(Aq, dbname \*(Aqfoodb\*(Aq, port \*(Aq5432\*(Aq);
105 .fi
106 .if n \{\
107 .RE
108 .\}
109 .sp
110 See
111 postgres_fdw
112 for more details\&.
113 .SH "COMPATIBILITY"
114 .PP
115 \fBCREATE SERVER\fR
116 conforms to ISO/IEC 9075\-9 (SQL/MED)\&.
117 .SH "SEE ALSO"
118 ALTER SERVER (\fBALTER_SERVER\fR(7)), DROP SERVER (\fBDROP_SERVER\fR(7)), CREATE FOREIGN DATA WRAPPER (\fBCREATE_FOREIGN_DATA_WRAPPER\fR(7)), CREATE FOREIGN TABLE (\fBCREATE_FOREIGN_TABLE\fR(7)), CREATE USER MAPPING (\fBCREATE_USER_MAPPING\fR(7))