2010-09-20 22:08:53 +02:00
|
|
|
<!-- doc/src/sgml/adminpack.sgml -->
|
2007-12-06 05:12:10 +01:00
|
|
|
|
2011-05-08 04:29:20 +02:00
|
|
|
<sect1 id="adminpack" xreflabel="adminpack">
|
2007-11-11 00:30:46 +01:00
|
|
|
<title>adminpack</title>
|
2007-12-06 05:12:10 +01:00
|
|
|
|
2007-12-02 23:33:20 +01:00
|
|
|
<indexterm zone="adminpack">
|
|
|
|
<primary>adminpack</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
2007-11-11 00:30:46 +01:00
|
|
|
<para>
|
2007-12-06 05:12:10 +01:00
|
|
|
<filename>adminpack</> provides a number of support functions which
|
|
|
|
<application>pgAdmin</> and other administration and management tools can
|
|
|
|
use to provide additional functionality, such as remote management
|
|
|
|
of server log files.
|
2016-08-11 03:39:50 +02:00
|
|
|
Use of all these functions is restricted to superusers.
|
2007-11-11 00:30:46 +01:00
|
|
|
</para>
|
|
|
|
|
2016-08-11 03:39:50 +02:00
|
|
|
<para>
|
|
|
|
The functions shown in <xref linkend="functions-adminpack-table"> provide
|
|
|
|
write access to files on the machine hosting the server. (See also the
|
|
|
|
functions in <xref linkend="functions-admin-genfile-table">, which
|
|
|
|
provide read-only access.)
|
|
|
|
Only files within the database cluster directory can be accessed, but
|
|
|
|
either a relative or absolute path is allowable.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<table id="functions-adminpack-table">
|
|
|
|
<title><filename>adminpack</> Functions</title>
|
|
|
|
<tgroup cols="3">
|
|
|
|
<thead>
|
|
|
|
<row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
2007-12-06 05:12:10 +01:00
|
|
|
|
2016-08-11 03:39:50 +02:00
|
|
|
<tbody>
|
|
|
|
<row>
|
|
|
|
<entry><function>pg_catalog.pg_file_write(filename text, data text, append boolean)</function></entry>
|
|
|
|
<entry><type>bigint</type></entry>
|
|
|
|
<entry>
|
|
|
|
Write, or append to, a text file
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry><function>pg_catalog.pg_file_rename(oldname text, newname text <optional>, archivename text</optional>)</function></entry>
|
|
|
|
<entry><type>boolean</type></entry>
|
|
|
|
<entry>
|
|
|
|
Rename a file
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry><function>pg_catalog.pg_file_unlink(filename text)</function></entry>
|
|
|
|
<entry><type>boolean</type></entry>
|
|
|
|
<entry>
|
|
|
|
Remove a file
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry><function>pg_catalog.pg_logdir_ls()</function></entry>
|
|
|
|
<entry><type>setof record</type></entry>
|
|
|
|
<entry>
|
|
|
|
List the log files in the <varname>log_directory</> directory
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<indexterm>
|
|
|
|
<primary>pg_file_write</primary>
|
|
|
|
</indexterm>
|
|
|
|
<para>
|
|
|
|
<function>pg_file_write</> writes the specified <parameter>data</> into
|
|
|
|
the file named by <parameter>filename</>. If <parameter>append</> is
|
|
|
|
false, the file must not already exist. If <parameter>append</> is true,
|
|
|
|
the file can already exist, and will be appended to if so.
|
|
|
|
Returns the number of bytes written.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<indexterm>
|
|
|
|
<primary>pg_file_rename</primary>
|
|
|
|
</indexterm>
|
|
|
|
<para>
|
|
|
|
<function>pg_file_rename</> renames a file. If <parameter>archivename</>
|
|
|
|
is omitted or NULL, it simply renames <parameter>oldname</>
|
|
|
|
to <parameter>newname</> (which must not already exist).
|
|
|
|
If <parameter>archivename</> is provided, it first
|
|
|
|
renames <parameter>newname</> to <parameter>archivename</> (which must
|
|
|
|
not already exist), and then renames <parameter>oldname</>
|
|
|
|
to <parameter>newname</>. In event of failure of the second rename step,
|
|
|
|
it will try to rename <parameter>archivename</> back
|
|
|
|
to <parameter>newname</> before reporting the error.
|
|
|
|
Returns true on success, false if the source file(s) are not present or
|
|
|
|
not writable; other cases throw errors.
|
|
|
|
</para>
|
2007-12-06 05:12:10 +01:00
|
|
|
|
2016-08-11 03:39:50 +02:00
|
|
|
<indexterm>
|
|
|
|
<primary>pg_file_unlink</primary>
|
|
|
|
</indexterm>
|
|
|
|
<para>
|
|
|
|
<function>pg_file_unlink</> removes the specified file.
|
|
|
|
Returns true on success, false if the specified file is not present
|
|
|
|
or the <function>unlink()</> call fails; other cases throw errors.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<indexterm>
|
|
|
|
<primary>pg_logdir_ls</primary>
|
|
|
|
</indexterm>
|
|
|
|
<para>
|
|
|
|
<function>pg_logdir_ls</> returns the start timestamps and path
|
|
|
|
names of all the log files in the <xref linkend="guc-log-directory">
|
|
|
|
directory. The <xref linkend="guc-log-filename"> parameter must have its
|
|
|
|
default setting (<literal>postgresql-%Y-%m-%d_%H%M%S.log</>) to use this
|
|
|
|
function.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The functions shown
|
|
|
|
in <xref linkend="functions-adminpack-deprecated-table"> are deprecated
|
|
|
|
and should not be used in new applications; instead use those shown
|
|
|
|
in <xref linkend="functions-admin-signal-table">
|
|
|
|
and <xref linkend="functions-admin-genfile-table">. These functions are
|
|
|
|
provided in <filename>adminpack</> only for compatibility with old
|
|
|
|
versions of <application>pgAdmin</>.
|
|
|
|
</para>
|
2007-12-06 05:12:10 +01:00
|
|
|
|
2016-08-11 03:39:50 +02:00
|
|
|
<table id="functions-adminpack-deprecated-table">
|
|
|
|
<title>Deprecated <filename>adminpack</> Functions</title>
|
|
|
|
<tgroup cols="3">
|
|
|
|
<thead>
|
|
|
|
<row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
2007-12-06 05:12:10 +01:00
|
|
|
|
2016-08-11 03:39:50 +02:00
|
|
|
<tbody>
|
|
|
|
<row>
|
|
|
|
<entry><function>pg_catalog.pg_file_read(filename text, offset bigint, nbytes bigint)</function></entry>
|
|
|
|
<entry><type>text</type></entry>
|
|
|
|
<entry>
|
|
|
|
Alternate name for <function>pg_read_file()</>
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry><function>pg_catalog.pg_file_length(filename text)</function></entry>
|
|
|
|
<entry><type>bigint</type></entry>
|
|
|
|
<entry>
|
|
|
|
Same as <structfield>size</> column returned
|
|
|
|
by <function>pg_stat_file()</>
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry><function>pg_catalog.pg_logfile_rotate()</function></entry>
|
|
|
|
<entry><type>integer</type></entry>
|
|
|
|
<entry>
|
|
|
|
Alternate name for <function>pg_rotate_logfile()</>, but note that it
|
|
|
|
returns integer 0 or 1 rather than boolean
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</table>
|
2007-11-11 00:30:46 +01:00
|
|
|
|
|
|
|
</sect1>
|