-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadminpack.html
More file actions
100 lines (100 loc) · 11.4 KB
/
adminpack.html
File metadata and controls
100 lines (100 loc) · 11.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?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="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="contrib.html" title="付録F 追加で提供されるモジュール" /><link rel="next" href="amcheck.html" title="F.2. amcheck" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 12.4文書</a></th></tr><tr><td width="10%" align="left"></td><td width="10%" align="left"></td><td width="60%" align="center"><a href="contrib.html" title="付録F 追加で提供されるモジュール">付録F 追加で提供されるモジュール</a></td><td width="20%" align="right"><div class="actions"><a class="issue" title="github" href="https://github.com/pgsql-jp/jpug-doc/issues/new?title=version 12.4 adminpack.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="contrib.html" title="付録F 追加で提供されるモジュール">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="付録F 追加で提供されるモジュール">上へ</a></td><td width="60%" align="center">F.1. adminpack</td><td width="20%" align="right"> <a accesskey="n" href="amcheck.html" title="F.2. amcheck">次へ</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</h2></div></div></div><a id="id-1.11.7.10.2" class="indexterm"></a><p>
<span class="original">
<filename>adminpack</filename> provides a number of support functions which
<application>pgAdmin</application> 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 only allowed to the superuser by default but may be
allowed to other users by using the <command>GRANT</command> command.
</span>
<code class="filename">adminpack</code>は、<span class="application">pgAdmin</span>やその他の管理・運用ツールがサーバログファイルの遠隔管理を行うなどの、追加的な機能を提供できるようにするための数多くのサポート関数を提供します。
デフォルトでは、この関数の使用はすべてスーパーユーザに限定されていますが、<code class="command">GRANT</code>コマンドを使用して他のユーザーに許可されている場合があります。
</p><p>
<span class="original">
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, unless the
user is a superuser or given one of the pg_read_server_files, or pg_write_server_files
roles, as appropriate for the function, but either a relative or absolute path is
allowable.
</span>
<a class="xref" href="adminpack.html#FUNCTIONS-ADMINPACK-TABLE" title="表F.1 adminpack関数">表 F.1</a>に示す関数はサーバをホスティングしているマシン上のファイルに対して書き込みアクセスを提供します。
(<a class="xref" href="functions-admin.html#FUNCTIONS-ADMIN-GENFILE-TABLE" title="表9.94 汎用ファイルアクセス関数">表 9.94</a>の関数も参照してください。そちらは読み取り専用アクセスを提供します。)
ユーザーがスーパーユーザーか、関数に応じたpg_read_server_files、またはpg_write_server_filesロールのいずれかのロールを与えられていない限り、データベースクラスタディレクトリ内のファイルにのみアクセス可能です。
ただし、相対パスと絶対パスのどちらも利用できます。
</p><div class="table" id="FUNCTIONS-ADMINPACK-TABLE"><p class="title"><strong>表F.1 <code class="filename">adminpack</code>関数</strong></p><div class="table-contents"><span class="original">
<title><filename>adminpack</filename> Functions</title>
</span><table class="table" summary="adminpack関数" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>名前</th><th>戻り値の型</th><th>説明</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>
<span class="original">
Write, or append to, a text file
</span>
テキストファイルに書き込む、または追記する
</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>
<span class="original">
Rename a file
</span>
ファイル名を変更する
</td></tr><tr><td><code class="function">pg_catalog.pg_file_unlink(filename text)</code></td><td><code class="type">boolean</code></td><td>
<span class="original">
Remove a file
</span>
ファイルを削除する
</td></tr><tr><td><code class="function">pg_catalog.pg_logdir_ls()</code></td><td><code class="type">setof record</code></td><td>
<span class="original">
List the log files in the <varname>log_directory</varname> directory
</span>
<code class="varname">log_directory</code>ディレクトリ内のログファイルの一覧を表示する
</td></tr></tbody></table></div></div><br class="table-break" /><a id="id-1.11.7.10.6" class="indexterm"></a><p>
<span class="original">
<function>pg_file_write</function> writes the specified <parameter>data</parameter> into
the file named by <parameter>filename</parameter>. If <parameter>append</parameter> is
false, the file must not already exist. If <parameter>append</parameter> is true,
the file can already exist, and will be appended to if so.
Returns the number of bytes written.
</span>
<code class="function">pg_file_write</code>は指定された<em class="parameter"><code>data</code></em>を<em class="parameter"><code>filename</code></em>で指定されたファイルに書き込みます
<em class="parameter"><code>append</code></em>が偽であれば、ファイルは既に存在していてはいけません。
<em class="parameter"><code>append</code></em>が真であれば、ファイルが既に存在していても構いません。その場合、追記されます。
書き込んだバイト数を返します。
</p><a id="id-1.11.7.10.8" class="indexterm"></a><p>
<span class="original">
<function>pg_file_rename</function> renames a file. If <parameter>archivename</parameter>
is omitted or NULL, it simply renames <parameter>oldname</parameter>
to <parameter>newname</parameter> (which must not already exist).
If <parameter>archivename</parameter> is provided, it first
renames <parameter>newname</parameter> to <parameter>archivename</parameter> (which must
not already exist), and then renames <parameter>oldname</parameter>
to <parameter>newname</parameter>. In event of failure of the second rename step,
it will try to rename <parameter>archivename</parameter> back
to <parameter>newname</parameter> before reporting the error.
Returns true on success, false if the source file(s) are not present or
not writable; other cases throw errors.
</span>
<code class="function">pg_file_rename</code>はファイルの名前を変更します。
<em class="parameter"><code>archivename</code></em>が省略されたり、NULLである場合は、単純に<em class="parameter"><code>oldname</code></em>を<em class="parameter"><code>newname</code></em>(既に存在していてはいけません)に変更します。
<em class="parameter"><code>archivename</code></em>が指定されていれば、まず<em class="parameter"><code>newname</code></em>を<em class="parameter"><code>archivename</code></em>(既に存在していてはいけません)に変更し、それから<em class="parameter"><code>oldname</code></em>を<em class="parameter"><code>newname</code></em>に変更します。
第2段階の名前の変更が失敗した場合には、エラーを報告する前に<em class="parameter"><code>archivename</code></em>を<em class="parameter"><code>newname</code></em>に戻そうとします。
成功した場合には真を、元のファイルが存在しなかったり、書き込みできなかった場合には偽を返します。その他の場合にはエラーを発生します。
</p><a id="id-1.11.7.10.10" class="indexterm"></a><p>
<span class="original">
<function>pg_file_unlink</function> removes the specified file.
Returns true on success, false if the specified file is not present
or the <function>unlink()</function> call fails; other cases throw errors.
</span>
<code class="function">pg_file_unlink</code>は指定されたファイルを削除します。
成功した場合には真を、指定されたファイルが存在しなかったり、<code class="function">unlink()</code>の呼出しが失敗した場合には偽を返します。その他の場合にはエラーを発生します。
</p><a id="id-1.11.7.10.12" class="indexterm"></a><p>
<span class="original">
<function>pg_logdir_ls</function> 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</literal>) to use this
function.
</span>
<code class="function">pg_logdir_ls</code>は<a class="xref" href="runtime-config-logging.html#GUC-LOG-DIRECTORY">log_directory</a>ディレクトリ内にあるログファイルすべての開始時のタイムスタンプとパス名を返します。
この関数を使うには、<a class="xref" href="runtime-config-logging.html#GUC-LOG-FILENAME">log_filename</a>パラメータはデフォルト設定(<code class="literal">postgresql-%Y-%m-%d_%H%M%S.log</code>)でなければなりません。
</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="contrib.html">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="amcheck.html">次へ</a></td></tr><tr><td width="40%" align="left" valign="top">付録F 追加で提供されるモジュール </td><td width="20%" align="center"><a accesskey="h" href="index.html">ホーム</a></td><td width="40%" align="right" valign="top"> F.2. amcheck</td></tr></table></div></body></html>