Updated on 2025-07-22 GMT+08:00

DROP SERVER

Description

Drops an existing data server.

Precautions

Only the server owner or a user granted the DROP permission can run the DROP SERVER command. System administrators have 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 dropped.

  • CASCADE | RESTRICT

    • CASCADE: automatically drops the objects that depend on the data server.

    • RESTRICT: refuses to drop the server if any objects depend on it. This is the default action.

Examples

-- Create a server.
openGauss=# create server my_server foreign data wrapper log_fdw;
CREATE SERVER

-- Drop my_server.
openGauss=# DROP SERVER my_server;
DROP SERVER

Helpful Links

ALTER SERVER and CREATE SERVER