codekingpro/portable-devtools
115k
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!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 — pgAdmin support toolpack</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions" /><link rel="next" href="amcheck.html" title="F.2. amcheck — tools to verify table and index consistency" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.1. adminpack — pgAdmin support toolpack</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules and Extensions</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="amcheck.html" title="F.2. amcheck — tools to verify table and index consistency">Next</a></td></tr></table><hr /></div><div class="sect1" id="ADMINPACK"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.1. adminpack — pgAdmin support toolpack <a href="#ADMINPACK" class="id_link">#</a></h2></div></div></div><a id="id-1.11.7.11.2" class="indexterm"></a><p>3 <code class="filename">adminpack</code> provides a number of support functions which4 <span class="application">pgAdmin</span> and other administration and management tools can5 use to provide additional functionality, such as remote management6 of server log files.7 Use of all these functions is only allowed to database superusers by default, but may be8 allowed to other users by using the <code class="command">GRANT</code> command.9 </p><p>10 The functions shown in <a class="xref" href="adminpack.html#FUNCTIONS-ADMINPACK-TABLE" title="Table F.1. adminpack Functions">Table F.1</a> provide11 write access to files on the machine hosting the server. (See also the12 functions in <a class="xref" href="functions-admin.html#FUNCTIONS-ADMIN-GENFILE-TABLE" title="Table 9.101. Generic File Access Functions">Table 9.101</a>, which13 provide read-only access.)14 Only files within the database cluster directory can be accessed, unless the15 user is a superuser or given privileges of one of the16 <code class="literal">pg_read_server_files</code> or17 <code class="literal">pg_write_server_files</code> roles, as appropriate for the18 function, but either a relative or absolute path is allowable.19 </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 /></colgroup><thead><tr><th class="func_table_entry"><p class="func_signature">20 Function21 </p>22 <p>23 Description24 </p></th></tr></thead><tbody><tr><td class="func_table_entry"><p class="func_signature">25 <code class="function">pg_catalog.pg_file_write</code> ( <em class="parameter"><code>filename</code></em> <code class="type">text</code>, <em class="parameter"><code>data</code></em> <code class="type">text</code>, <em class="parameter"><code>append</code></em> <code class="type">boolean</code> )26 → <code class="returnvalue">bigint</code>27 </p>28 <p>29 Writes, or appends to, a text file.30 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">31 <code class="function">pg_catalog.pg_file_sync</code> ( <em class="parameter"><code>filename</code></em> <code class="type">text</code> )32 → <code class="returnvalue">void</code>33 </p>34 <p>35 Flushes a file or directory to disk.36 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">37 <code class="function">pg_catalog.pg_file_rename</code> ( <em class="parameter"><code>oldname</code></em> <code class="type">text</code>, <em class="parameter"><code>newname</code></em> <code class="type">text</code> [<span class="optional">, <em class="parameter"><code>archivename</code></em> <code class="type">text</code> </span>] )38 → <code class="returnvalue">boolean</code>39 </p>40 <p>41 Renames a file.42 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">43 <code class="function">pg_catalog.pg_file_unlink</code> ( <em class="parameter"><code>filename</code></em> <code class="type">text</code> )44 → <code class="returnvalue">boolean</code>45 </p>46 <p>47 Removes a file.48 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">49 <code class="function">pg_catalog.pg_logdir_ls</code> ()50 → <code class="returnvalue">setof record</code>51 </p>52 <p>53 Lists the log files in the <code class="varname">log_directory</code> directory.54 </p></td></tr></tbody></table></div></div><br class="table-break" /><a id="id-1.11.7.11.6" class="indexterm"></a><p>55 <code class="function">pg_file_write</code> writes the specified <em class="parameter"><code>data</code></em> into56 the file named by <em class="parameter"><code>filename</code></em>. If <em class="parameter"><code>append</code></em> is57 false, the file must not already exist. If <em class="parameter"><code>append</code></em> is true,58 the file can already exist, and will be appended to if so.59 Returns the number of bytes written.60 </p><a id="id-1.11.7.11.8" class="indexterm"></a><p>61 <code class="function">pg_file_sync</code> fsyncs the specified file or directory62 named by <em class="parameter"><code>filename</code></em>. An error is thrown63 on failure (e.g., the specified file is not present). Note that64 <a class="xref" href="runtime-config-error-handling.html#GUC-DATA-SYNC-RETRY">data_sync_retry</a> has no effect on this function,65 and therefore a PANIC-level error will not be raised even on failure to66 flush database files.67 </p><a id="id-1.11.7.11.10" class="indexterm"></a><p>68 <code class="function">pg_file_rename</code> renames a file. If <em class="parameter"><code>archivename</code></em>69 is omitted or NULL, it simply renames <em class="parameter"><code>oldname</code></em>70 to <em class="parameter"><code>newname</code></em> (which must not already exist).71 If <em class="parameter"><code>archivename</code></em> is provided, it first72 renames <em class="parameter"><code>newname</code></em> to <em class="parameter"><code>archivename</code></em> (which must73 not already exist), and then renames <em class="parameter"><code>oldname</code></em>74 to <em class="parameter"><code>newname</code></em>. In event of failure of the second rename step,75 it will try to rename <em class="parameter"><code>archivename</code></em> back76 to <em class="parameter"><code>newname</code></em> before reporting the error.77 Returns true on success, false if the source file(s) are not present or78 not writable; other cases throw errors.79 </p><a id="id-1.11.7.11.12" class="indexterm"></a><p>80 <code class="function">pg_file_unlink</code> removes the specified file.81 Returns true on success, false if the specified file is not present82 or the <code class="function">unlink()</code> call fails; other cases throw errors.83 </p><a id="id-1.11.7.11.14" class="indexterm"></a><p>84 <code class="function">pg_logdir_ls</code> returns the start timestamps and path85 names of all the log files in the <a class="xref" href="runtime-config-logging.html#GUC-LOG-DIRECTORY">log_directory</a>86 directory. The <a class="xref" href="runtime-config-logging.html#GUC-LOG-FILENAME">log_filename</a> parameter must have its87 default setting (<code class="literal">postgresql-%Y-%m-%d_%H%M%S.log</code>) to use this88 function.89 </p></div><div class="navfooter"><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 and Extensions">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="amcheck.html" title="F.2. amcheck — tools to verify table and index consistency">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix F. Additional Supplied Modules and Extensions </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> F.2. amcheck — tools to verify table and index consistency</td></tr></table></div></body></html>