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

DROP DIRECTORY

Description

Drops a specified directory.

Precautions

When enable_access_server_directory is set to off, only the initial user is allowed to delete directory objects. When enable_access_server_directory is set to on, a user with the SYSADMIN permission, the owner of the directory object, a user who is granted the DROP permission of the directory, or a user who inherits permissions of the built-in role gs_role_directory_drop can delete directory objects.

Syntax

1
DROP DIRECTORY [ IF EXISTS ] directory_name;

Parameters

  • directory_name

    Specifies the name of the directory to be deleted.

    Value range: an existing directory name

Examples

1
2
3
4
5
-- Create a directory.
openGauss=# CREATE OR REPLACE DIRECTORY  dir  as '/tmp/';

-- Drop a foreign table.
openGauss=# DROP DIRECTORY dir;

Helpful Links

CREATE DIRECTORY and ALTER DIRECTORY