ALTER DIRECTORY v15

Name

ALTER DIRECTORY Change the owner of a directory created using the CREATE DIRECTORY command.

Synopsis

ALTER DIRECTORY <name> OWNER TO <rolename>

Description

The ALTER DIRECTORY ...OWNER TO command changes the owner of a directory. You must have the superuser privilege to execute this command. The new owner of the directory must also have the superuser privilege.

Parameters

name

The name of the directory to alter.

rolename

The name of an owner of the directory.

Examples

These examples change ownership. bob and carol are superusers. bob is a current owner of the directory EMPDIR.

SELECT * FROM all_directories where directory_name = 'EMPDIR' order
by 1,2,3;
Output
owner | directory_name | directory_path
-------+----------------+----------------
 bob   | EMPDIR         | /path
(1 row)

To change the ownership of directory EMPDIR to carol:

ALTER DIRECTORY EMPDIR OWNER TO carol;
ALTER DIRECTORY

SELECT * FROM all_directories where directory_name = 'EMPDIR' order by
1,2,3;
Output
owner | directory_name | directory_path
-------+----------------+----------------
 carol | EMPDIR         | /path
(1 row)

See also

CREATE DIRECTORY, DROP DIRECTORY