CREATE_SERVER(7pg17)
β¨ CREATE_SERVER β¨
okay so bestie, welcome to CREATE_SERVER(7) from the PostgreSQL 17.11 Documentation. Itβs giving βdefine a new foreign serverβ main character energy, and weβre gonna cover every single detail. π«Άπ
πΈ NAME πΈ
CREATE_SERVER β define a new foreign server. periodt. π
β¨ SYNOPSIS β¨
CREATE SERVER [ IF NOT EXISTS ] server_name [ TYPE 'server_type' ] [ VERSION 'server_version' ]
FOREIGN DATA WRAPPER fdw_name
[ OPTIONS ( option 'value' [, ... ] ) ]
this is the whole shape of the command β no cap, thatβs the synopsis. β¨
π DESCRIPTION π
CREATE SERVER defines a new foreign server. The user who defines the server becomes its owner. slay, ownership acquired. π
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. iykyk β user mappings are a whole vibe. π¦
The server name must be unique within the database. no cap, no duplicate server names, bestie. π
Creating a server requires USAGE privilege on the foreign-data wrapper being used. Thatβs the vibe check: no USAGE, no server creation. π
π PARAMETERS π
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. literally, it might be a totally different vibe. πserver_nameβ the name of the foreign server to be created. iconic. β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. itβs giving manager energy. π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. πΈ
π¦ NOTES π¦
When using the dblink module, a foreign serverβs name can be used as an argument of the dblink_connect(3) function to indicate the connection parameters. It is necessary to have the USAGE privilege on the foreign server to be able to use it in this way. periodt. π«
If the foreign server supports sort pushdown, it is necessary for it to have the same sort ordering as the local server. fr fr. π
π EXAMPLES π
Create a server myserver that uses the foreign-data wrapper postgres_fdw:
CREATE SERVER myserver FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'foo', dbname 'foodb', port '5432');
See postgres_fdw for more details. obsessed. β¨
β COMPATIBILITY β
CREATE SERVER conforms to ISO/IEC 9075-9 (SQL/MED). periodt. π
π SEE ALSO π
ALTER SERVER(ALTER_SERVER(7))DROP SERVER(DROP_SERVER(7))CREATE FOREIGN DATA WRAPPER(CREATE_FOREIGN_DATA_WRAPPER(7))CREATE FOREIGN TABLE(CREATE_FOREIGN_TABLE(7))CREATE USER MAPPING(CREATE_USER_MAPPING(7))
mwah π β this page is from PostgreSQL 17.11, dated 2026, and its manual name is CREATE SERVER(7). go be the main character of your own foreign server, bestie. π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms