Postgres Plus Advanced Server Oracle Compatibility Developer's Guide :

Previous PageTable Of ContentsNext Page

3.3.12 CREATE DIRECTORY

Name

CREATE DIRECTORY -- create an alias for a file system directory path

Synopsis

CREATE DIRECTORY name AS 'pathname'

Description

The CREATE DIRECTORY command creates an alias for a file system directory pathname. You must be a database superuser to use this command.

When the alias is specified as the appropriate parameter to the programs of the UTL_FILE package, the operating system files are created in, or accessed from the directory corresponding to the given alias. See Section 7.4 for information on the UTL_FILE package.

Parameters

name

The directory alias name.

pathname

The fully-qualified directory path represented by the alias name. The CREATE DIRECTORY command does not create the operating system directory. The physical directory must be created independently using the appropriate operating system commands.

Notes

The operating system user id, enterprisedb, must have the appropriate read and/or write privileges on the directory if the UTL_FILE package is to be used to create and/or read files using the directory.

The directory alias is stored in the pg_catalog.edb_dir system catalog table. Note that edb_dir is not an Oracle compatible table.

Use the DROP DIRECTORY command to delete the directory alias. When a directory alias is deleted, the corresponding physical file system directory is not affected. The file system directory must be deleted using the appropriate operating system commands.

In a Linux system, the directory name separator is a forward slash (/).

In a Windows system, the directory name separator can be specified as a forward slash (/) or two consecutive backslashes (\\).

Examples

Create an alias named empdir for directory /tmp/empdir on Linux:

CREATE DIRECTORY empdir AS '/tmp/empdir';

Create an alias named empdir for directory C:\TEMP\EMPDIR on Windows:

CREATE DIRECTORY empdir AS 'C:/TEMP/EMPDIR';

View all of the directory aliases:

SELECT * FROM pg_catalog.edb_dir;

 dirname |    dirpath
---------+----------------
 empdir  | C:/TEMP/EMPDIR
(1 row)

See Also

DROP DIRECTORY

Previous PageTable Of ContentsNext Page