バージョンごとのドキュメント一覧

F.1. adminpack — pgAdminサポートツールパック #

<title>adminpack &mdash; pgAdmin support toolpack</title>

<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 database superusers by default, but may be allowed to other users by using the <command>GRANT</command> command. adminpackは、pgAdminやその他の管理・運用ツールがサーバログファイルの遠隔管理を行うなどの、追加的な機能を提供できるようにするための数多くのサポート関数を提供します。 デフォルトでは、この関数の使用はすべてデータベーススーパーユーザに限定されていますが、GRANTコマンドを使用して他のユーザーに許可されている場合があります。

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 privileges of one of the <literal>pg_read_server_files</literal> or <literal>pg_write_server_files</literal> roles, as appropriate for the function, but either a relative or absolute path is allowable. 表 F.1に示す関数はサーバをホスティングしているマシン上のファイルに対して書き込みアクセスを提供します。 (表 9.101の関数も参照してください。そちらは読み取り専用アクセスを提供します。) ユーザがスーパーユーザか、関数に応じたpg_read_server_files、またはpg_write_server_filesロールのいずれかの権限を与えられていない限り、データベースクラスタディレクトリ内のファイルにのみアクセス可能です。 ただし、相対パスと絶対パスのどちらも利用できます。

表F.1 adminpack関数

<title><filename>adminpack</filename> Functions</title>

Function 関数

Description 説明

pg_catalog.pg_file_write ( filename text, data text, append boolean ) → bigint

Writes, or appends to, a text file. テキストファイルに書き込む、または追記する

pg_catalog.pg_file_sync ( filename text ) → void

Flushes a file or directory to disk. ファイルまたはディレクトリをディスクにフラッシュする

pg_catalog.pg_file_rename ( oldname text, newname text [, archivename text ] ) → boolean

Renames a file. ファイル名を変更する

pg_catalog.pg_file_unlink ( filename text ) → boolean

Removes a file. ファイルを削除する

pg_catalog.pg_logdir_ls () → setof record

Lists the log files in the <varname>log_directory</varname> directory. log_directoryディレクトリ内のログファイルの一覧を表示する


<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. pg_file_writeは指定されたdatafilenameで指定されたファイルに書き込みます appendが偽であれば、ファイルは既に存在していてはいけません。 appendが真であれば、ファイルが既に存在していても構いません。その場合、追記されます。 書き込んだバイト数を返します。

<function>pg_file_sync</function> fsyncs the specified file or directory named by <parameter>filename</parameter>. An error is thrown on failure (e.g., the specified file is not present). Note that <xref linkend="guc-data-sync-retry"/> has no effect on this function, and therefore a PANIC-level error will not be raised even on failure to flush database files. pg_file_syncfilenameで指定されたファイルまたはディレクトリをfsyncします。 (例えば、指定されたファイルが存在しないなど)失敗するとエラーを発生します。 data_sync_retryはこの関数には影響しませんので、データベースファイルのフラッシュの失敗であってもPANICレベルのエラーは起こらないことに注意してください。

<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. pg_file_renameはファイルの名前を変更します。 archivenameが省略されたり、NULLである場合は、単純にoldnamenewname(既に存在していてはいけません)に変更します。 archivenameが指定されていれば、まずnewnamearchivename(既に存在していてはいけません)に変更し、それからoldnamenewnameに変更します。 第2段階の名前の変更が失敗した場合には、エラーを報告する前にarchivenamenewnameに戻そうとします。 成功した場合には真を、元のファイルが存在しなかったり、書き込みできなかった場合には偽を返します。その他の場合にはエラーを発生します。

<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. pg_file_unlinkは指定されたファイルを削除します。 成功した場合には真を、指定されたファイルが存在しなかったり、unlink()の呼出しが失敗した場合には偽を返します。その他の場合にはエラーを発生します。

<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. pg_logdir_lslog_directoryディレクトリ内にあるログファイルすべての開始時のタイムスタンプとパス名を返します。 この関数を使うには、log_filenameパラメータはデフォルト設定(postgresql-%Y-%m-%d_%H%M%S.log)でなければなりません。