| Server IP : 172.67.134.114 / Your IP : 162.159.115.41 Web Server : Apache/2.4.37 System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64 User : ricodeal ( 1046) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/postgresql-docs/html/ |
Upload File : |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>F.1. adminpack</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="[email protected]" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="contrib.html" title="Appendix F. Additional Supplied Modules" /><link rel="next" href="amcheck.html" title="F.2. amcheck" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.1. adminpack</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="contrib.html" title="Appendix F. Additional Supplied Modules">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 10.23 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="amcheck.html" title="F.2. amcheck">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="ADMINPACK"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.1. adminpack</h2></div></div></div><a id="id-1.11.7.10.2" class="indexterm"></a><p> <code class="filename">adminpack</code> provides a number of support functions which
<span class="application">pgAdmin</span> and other administration and management tools can
use to provide additional functionality, such as remote management
of server log files.
Use of all these functions is restricted to superusers.
</p><p> The functions shown in <a class="xref" href="adminpack.html#FUNCTIONS-ADMINPACK-TABLE" title="Table F.1. adminpack Functions">Table F.1</a> provide
write access to files on the machine hosting the server. (See also the
functions in <a class="xref" href="functions-admin.html#FUNCTIONS-ADMIN-GENFILE-TABLE" title="Table 9.88. Generic File Access Functions">Table 9.88</a>, which
provide read-only access.)
Only files within the database cluster directory can be accessed, but
either a relative or absolute path is allowable.
</p><div class="table" id="FUNCTIONS-ADMINPACK-TABLE"><p class="title"><strong>Table F.1. <code class="filename">adminpack</code> Functions</strong></p><div class="table-contents"><table class="table" summary="adminpack Functions" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="function">pg_catalog.pg_file_write(filename text, data text, append boolean)</code></td><td><code class="type">bigint</code></td><td> Write, or append to, a text file
</td></tr><tr><td><code class="function">pg_catalog.pg_file_rename(oldname text, newname text [<span class="optional">, archivename text</span>])</code></td><td><code class="type">boolean</code></td><td> Rename a file
</td></tr><tr><td><code class="function">pg_catalog.pg_file_unlink(filename text)</code></td><td><code class="type">boolean</code></td><td> Remove a file
</td></tr><tr><td><code class="function">pg_catalog.pg_logdir_ls()</code></td><td><code class="type">setof record</code></td><td> List the log files in the <code class="varname">log_directory</code> directory
</td></tr></tbody></table></div></div><br class="table-break" /><a id="id-1.11.7.10.6" class="indexterm"></a><p> <code class="function">pg_file_write</code> writes the specified <em class="parameter"><code>data</code></em> into
the file named by <em class="parameter"><code>filename</code></em>. If <em class="parameter"><code>append</code></em> is
false, the file must not already exist. If <em class="parameter"><code>append</code></em> is true,
the file can already exist, and will be appended to if so.
Returns the number of bytes written.
</p><a id="id-1.11.7.10.8" class="indexterm"></a><p> <code class="function">pg_file_rename</code> renames a file. If <em class="parameter"><code>archivename</code></em>
is omitted or NULL, it simply renames <em class="parameter"><code>oldname</code></em>
to <em class="parameter"><code>newname</code></em> (which must not already exist).
If <em class="parameter"><code>archivename</code></em> is provided, it first
renames <em class="parameter"><code>newname</code></em> to <em class="parameter"><code>archivename</code></em> (which must
not already exist), and then renames <em class="parameter"><code>oldname</code></em>
to <em class="parameter"><code>newname</code></em>. In event of failure of the second rename step,
it will try to rename <em class="parameter"><code>archivename</code></em> back
to <em class="parameter"><code>newname</code></em> before reporting the error.
Returns true on success, false if the source file(s) are not present or
not writable; other cases throw errors.
</p><a id="id-1.11.7.10.10" class="indexterm"></a><p> <code class="function">pg_file_unlink</code> removes the specified file.
Returns true on success, false if the specified file is not present
or the <code class="function">unlink()</code> call fails; other cases throw errors.
</p><a id="id-1.11.7.10.12" class="indexterm"></a><p> <code class="function">pg_logdir_ls</code> returns the start timestamps and path
names of all the log files in the <a class="xref" href="runtime-config-logging.html#GUC-LOG-DIRECTORY">log_directory</a>
directory. The <a class="xref" href="runtime-config-logging.html#GUC-LOG-FILENAME">log_filename</a> parameter must have its
default setting (<code class="literal">postgresql-%Y-%m-%d_%H%M%S.log</code>) to use this
function.
</p><p> The functions shown
in <a class="xref" href="adminpack.html#FUNCTIONS-ADMINPACK-DEPRECATED-TABLE" title="Table F.2. Deprecated adminpack Functions">Table F.2</a> are deprecated
and should not be used in new applications; instead use those shown
in <a class="xref" href="functions-admin.html#FUNCTIONS-ADMIN-SIGNAL-TABLE" title="Table 9.78. Server Signaling Functions">Table 9.78</a>
and <a class="xref" href="functions-admin.html#FUNCTIONS-ADMIN-GENFILE-TABLE" title="Table 9.88. Generic File Access Functions">Table 9.88</a>. These functions are
provided in <code class="filename">adminpack</code> only for compatibility with old
versions of <span class="application">pgAdmin</span>.
</p><div class="table" id="FUNCTIONS-ADMINPACK-DEPRECATED-TABLE"><p class="title"><strong>Table F.2. Deprecated <code class="filename">adminpack</code> Functions</strong></p><div class="table-contents"><table class="table" summary="Deprecated adminpack Functions" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="function">pg_catalog.pg_file_read(filename text, offset bigint, nbytes bigint)</code></td><td><code class="type">text</code></td><td> Alternate name for <code class="function">pg_read_file()</code>
</td></tr><tr><td><code class="function">pg_catalog.pg_file_length(filename text)</code></td><td><code class="type">bigint</code></td><td> Same as <code class="structfield">size</code> column returned
by <code class="function">pg_stat_file()</code>
</td></tr><tr><td><code class="function">pg_catalog.pg_logfile_rotate()</code></td><td><code class="type">integer</code></td><td> Alternate name for <code class="function">pg_rotate_logfile()</code>, but note that it
returns integer 0 or 1 rather than <code class="type">boolean</code>
</td></tr></tbody></table></div></div><br class="table-break" /></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="contrib.html" title="Appendix F. Additional Supplied Modules">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="amcheck.html" title="F.2. amcheck">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix F. Additional Supplied Modules </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 10.23 Documentation">Home</a></td><td width="40%" align="right" valign="top"> F.2. amcheck</td></tr></table></div></body></html>