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

ALTER SYSTEM

ALTER SYSTEM <refpurpose>change a server configuration parameter</refpurpose> — サーバの設定パラメータを変更する

概要

ALTER SYSTEM SET configuration_parameter { TO | = } { value | 'value' | DEFAULT }

ALTER SYSTEM RESET configuration_parameter
ALTER SYSTEM RESET ALL

説明

<title>Description</title>

<command>ALTER SYSTEM</command> is used for changing server configuration parameters across the entire database cluster. It can be more convenient than the traditional method of manually editing the <filename>postgresql.conf</filename> file. <command>ALTER SYSTEM</command> writes the given parameter setting to the <filename>postgresql.auto.conf</filename> file, which is read in addition to <filename>postgresql.conf</filename>. Setting a parameter to <literal>DEFAULT</literal>, or using the <command>RESET</command> variant, removes that configuration entry from the <filename>postgresql.auto.conf</filename> file. Use <literal>RESET ALL</literal> to remove all such configuration entries. ALTER SYSTEMはデータベースクラスタ全体にわたるサーバの設定パラメータを変更するのに使われます。 手作業でpostgresql.confファイルを編集するという伝統的な方法よりも、この方が便利かもしれません。 ALTER SYSTEMは指定されたパラメータ設定をpostgresql.auto.confファイルに書き出し、これがpostgresql.confに加えて読み込まれます。 パラメータをDEFAULTに設定する、あるいはこれの別表記であるRESETを使うと、postgresql.auto.confファイルから、その設定のエントリを削除します。 そのような設定のエントリをすべて削除するにはRESET ALLを使用してください。

Values set with <command>ALTER SYSTEM</command> will be effective after the next server configuration reload, or after the next server restart in the case of parameters that can only be changed at server start. A server configuration reload can be commanded by calling the SQL function <function>pg_reload_conf()</function>, running <literal>pg_ctl reload</literal>, or sending a <systemitem>SIGHUP</systemitem> signal to the main server process. ALTER SYSTEMで設定された値は、次回のサーバ設定の再ロードで、またサーバ開始時にのみ変更可能なパラメータについては次回のサーバ再起動で有効になります。 サーバ設定の再ロードは、SQL関数pg_reload_conf()の呼び出し、pg_ctl reloadの実行、あるいはメインのサーバプロセスにSIGHUPを送信することで実行できます。

Only superusers and users granted <literal>ALTER SYSTEM</literal> privilege on a parameter can change it using <command>ALTER SYSTEM</command>. Also, since this command acts directly on the file system and cannot be rolled back, it is not allowed inside a transaction block or function. スーパーユーザとパラメータに関するALTER SYSTEM権限を付与されたユーザーだけが、ALTER SYSTEMを使ってパラメータを変更できます。 また、このコマンドはファイルシステムに直接作用し、ロールバックできないため、トランザクションブロックや関数の内部で使うことはできません。

パラメータ

<title>Parameters</title>
configuration_parameter

Name of a settable configuration parameter. Available parameters are documented in <xref linkend="runtime-config"/>. 設定する設定パラメータの名前です。 利用可能なパラメータに付いては第20章に記述されています。

value

New value of the parameter. Values can be specified as string constants, identifiers, numbers, or comma-separated lists of these, as appropriate for the particular parameter. <literal>DEFAULT</literal> can be written to specify removing the parameter and its value from <filename>postgresql.auto.conf</filename>. パラメータの新しい値です。 値は、対象のパラメータとして適切な文字列定数、識別子、数値あるいはそれらをカンマで区切ったリストで指定できます。 DEFAULTと指定することができ、このとき、パラメータとその値をpostgresql.auto.confから削除します。

注釈

<title>Notes</title>

This command can't be used to set <xref linkend="guc-data-directory"/>, nor parameters that are not allowed in <filename>postgresql.conf</filename> (e.g., <link linkend="runtime-config-preset">preset options</link>). このコマンドではdata_directoryおよびpostgresql.confで設定できないパラメータ(例えばpreset options)を設定することはできません。

See <xref linkend="config-setting"/> for other ways to set the parameters. パラメータを設定するその他の方法については20.1を参照してください。

<title>Examples</title>

Set the <literal>wal_level</literal>: wal_levelを設定します。

ALTER SYSTEM SET wal_level = replica;

Undo that, restoring whatever setting was effective in <filename>postgresql.conf</filename>: それを取り消して、postgresql.confで有効だった設定に戻します。

ALTER SYSTEM RESET wal_level;

互換性

<title>Compatibility</title>

The <command>ALTER SYSTEM</command> statement is a <productname>PostgreSQL</productname> extension. ALTER SYSTEM文はPostgreSQLの拡張です。

関連項目

<title>See Also</title> SET, SHOW