{
    "content": [
        {
            "type": "text",
            "text": "# CREATE_SERVER(7) (man)\n\n**Summary:** CREATESERVER - define a new foreign server\n\n**Synopsis:** CREATE SERVER [ IF NOT EXISTS ] servername [ TYPE 'servertype' ] [ VERSION 'serverversion' ]\nFOREIGN DATA WRAPPER fdwname\n[ OPTIONS ( option 'value' [, ... ] ) ]\n\n## Examples\n\n- `Create a server myserver that uses the foreign-data wrapper postgresfdw:`\n- `CREATE SERVER myserver FOREIGN DATA WRAPPER postgresfdw OPTIONS (host 'foo', dbname 'foodb', port '5432');`\n- `See postgresfdw for more details.`\n\n## See Also\n\n- ALTERSERVER(7)\n- DROPSERVER(7)\n- CREATEFOREIGNDATAWRAPPER(7)\n- CREATEFOREIGNTABLE(7)\n- CREATEUSERMAPPING(7)\n- SERVER(7)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (4 lines)\n- **DESCRIPTION** (11 lines)\n- **PARAMETERS** (22 lines)\n- **NOTES** (7 lines)\n- **EXAMPLES** (6 lines)\n- **COMPATIBILITY** (2 lines)\n- **SEE ALSO** (7 lines)\n\n## Full Content\n\n### NAME\n\nCREATESERVER - define a new foreign server\n\n### SYNOPSIS\n\nCREATE SERVER [ IF NOT EXISTS ] servername [ TYPE 'servertype' ] [ VERSION 'serverversion' ]\nFOREIGN DATA WRAPPER fdwname\n[ OPTIONS ( option 'value' [, ... ] ) ]\n\n### DESCRIPTION\n\nCREATE SERVER defines a new foreign server. The user who defines the server becomes its\nowner.\n\nA foreign server typically encapsulates connection information that a foreign-data wrapper\nuses to access an external data resource. Additional user-specific connection information may\nbe specified by means of user mappings.\n\nThe server name must be unique within the database.\n\nCreating a server requires USAGE privilege on the foreign-data wrapper being used.\n\n### PARAMETERS\n\nIF NOT EXISTS\nDo not throw an error if a server with the same name already exists. A notice is issued\nin this case. Note that there is no guarantee that the existing server is anything like\nthe one that would have been created.\n\nservername\nThe name of the foreign server to be created.\n\nservertype\nOptional server type, potentially useful to foreign-data wrappers.\n\nserverversion\nOptional server version, potentially useful to foreign-data wrappers.\n\nfdwname\nThe name of the foreign-data wrapper that manages the server.\n\nOPTIONS ( option 'value' [, ... ] )\nThis clause specifies the options for the server. The options typically define the\nconnection details of the server, but the actual names and values are dependent on the\nserver's foreign-data wrapper.\n\n### NOTES\n\nWhen using the dblink module, a foreign server's name can be used as an argument of the\ndblinkconnect(3) function to indicate the connection parameters. It is necessary to have the\nUSAGE privilege on the foreign server to be able to use it in this way.\n\nIf the foreign server supports sort pushdown, it is necessary for it to have the same sort\nordering as the local server.\n\n### EXAMPLES\n\nCreate a server myserver that uses the foreign-data wrapper postgresfdw:\n\nCREATE SERVER myserver FOREIGN DATA WRAPPER postgresfdw OPTIONS (host 'foo', dbname 'foodb', port '5432');\n\nSee postgresfdw for more details.\n\n### COMPATIBILITY\n\nCREATE SERVER conforms to ISO/IEC 9075-9 (SQL/MED).\n\n### SEE ALSO\n\nALTER SERVER (ALTERSERVER(7)), DROP SERVER (DROPSERVER(7)), CREATE FOREIGN DATA WRAPPER\n(CREATEFOREIGNDATAWRAPPER(7)), CREATE FOREIGN TABLE (CREATEFOREIGNTABLE(7)), CREATE USER\nMAPPING (CREATEUSERMAPPING(7))\n\n\n\nPostgreSQL 14.23                                2026                                CREATE SERVER(7)\n\n"
        }
    ],
    "structuredContent": {
        "command": "CREATE_SERVER",
        "section": "7",
        "mode": "man",
        "summary": "CREATESERVER - define a new foreign server",
        "synopsis": "CREATE SERVER [ IF NOT EXISTS ] servername [ TYPE 'servertype' ] [ VERSION 'serverversion' ]\nFOREIGN DATA WRAPPER fdwname\n[ OPTIONS ( option 'value' [, ... ] ) ]",
        "flags": [],
        "examples": [
            "Create a server myserver that uses the foreign-data wrapper postgresfdw:",
            "CREATE SERVER myserver FOREIGN DATA WRAPPER postgresfdw OPTIONS (host 'foo', dbname 'foodb', port '5432');",
            "See postgresfdw for more details."
        ],
        "see_also": [
            {
                "name": "ALTERSERVER",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/ALTERSERVER/7/json"
            },
            {
                "name": "DROPSERVER",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/DROPSERVER/7/json"
            },
            {
                "name": "CREATEFOREIGNDATAWRAPPER",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/CREATEFOREIGNDATAWRAPPER/7/json"
            },
            {
                "name": "CREATEFOREIGNTABLE",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/CREATEFOREIGNTABLE/7/json"
            },
            {
                "name": "CREATEUSERMAPPING",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/CREATEUSERMAPPING/7/json"
            },
            {
                "name": "SERVER",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/SERVER/7/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "PARAMETERS",
                "lines": 22,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "COMPATIBILITY",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 7,
                "subsections": []
            }
        ]
    }
}