ALTER DIRECTORY v14

Name

ALTER DIRECTORY -- change the owner of a directory created using 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 be altered.

rolename

The name of an owner of the directory.

Examples

The following example demonstrates changing ownership; bob and carol are superusers. bob is a current owner of directory EMPDIR:

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

To alter 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;
 owner | directory_name | directory_path
-------+----------------+----------------
 carol | EMPDIR         | /path
(1 row)

The ownership of a directory is altered and granted to carol.

See also

CREATE DIRECTORY, DROP DIRECTORY