Database Reference
In-Depth Information
The adminpack extension
The
adminpack
extension provides support functions for
pgAdmin
and other
administration and management tools. Most of the administration tools need
to manipulate the iles; hence, these functions facilitate that kind of utilities
functionality. The syntax for the
adminpack
extension is as follows:
warehouse_db=# CREATE EXTENSION adminpack;
Let's discuss the different utility functionalities provided by the
adminpack
extension:
•
pg_file_write
: The
pg_file_write
function is used to create a new
ile or append an already existing ile. This can be explained using the
following example:
warehouse_db=# SELECT pg_file_write('foo.txt', 'Hello
World', false);
pg_file_write
---------------
11
(1 row)
$ cat /opt/PostgreSQL/9.4/data/foo.txt
Hello World
•
pg_file_rename
: The
pg_file_rename
function is used to rename an
existing ile. This can be explained using the following example:
warehouse_db=# SELECT pg_file_rename('foo.txt', 'bar.txt');
pg_file_rename
----------------
t
(1 row)
$ cat /opt/PostgreSQL/9.4/data/bar.txt
Hello World
•
pg_file_unlink
: The
page_file_unlink
function is used to unlink (delete)
an existing ile. This can be explained using the following example:
warehouse_db=# SELECT pg_file_unlink('bar.txt');
pg_file_unlink
----------------
t
(1 row)
$ cat /opt/PostgreSQL/9.4/data/bar.txt