Updated on 2024-06-03 GMT+08:00

DROP SERVER

Description

Deletes an existing data server.

Precautions

Only the server owner or a user granted with the DROP permission can run the DROP SERVER command. A system administrator has this permission by default.

Syntax

DROP SERVER [ IF EXISTS ] server_name [ CASCADE | RESTRICT ];

Parameters

  • IF EXISTS

    Reports a notice instead of an error if the specified data server does not exist.

  • server_name

    Specifies the name of the data server to be deleted.

  • CASCADE | RESTRICT
    • CASCADE: cascadingly deletes the objects that depend on the data server.
    • RESTRICT: refuses to delete the server if any objects depend on it. This is the default action.

Example

-- Create a server.
gaussdb=# CREATE SERVER my_server FOREIGN DATA WRAPPER log_fdw;
CREATE SERVER

-- Delete the server.
gaussdb=# DROP SERVER my_server;
DROP SERVER

Helpful Links

ALTER SERVER and CREATE SERVER