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

22.5. 定義済みロール #

<title>Predefined Roles</title>

<productname>PostgreSQL</productname> provides a set of predefined roles that provide access to certain, commonly needed, privileged capabilities and information. Administrators (including roles that have the <literal>CREATEROLE</literal> privilege) can <command>GRANT</command> these roles to users and/or other roles in their environment, providing those users with access to the specified capabilities and information. PostgreSQLでは、ある種の共通に必要で、特権のある機能や情報にアクセスできるよう、いくつかのあらかじめ定義されたロールを提供しています。 (CREATEROLE権限を持つロールを含む)管理者は自分の環境のユーザあるいはロールに対し、これらのロールをGRANT(付与)することで、それらのユーザに、その機能や情報を提供することができます。

The predefined roles are described in <xref linkend="predefined-roles-table"/>. Note that the specific permissions for each of the roles may change in the future as additional capabilities are added. Administrators should monitor the release notes for changes. 定義済みロールについては表 22.1で説明します。 それぞれのロールの個別の権限については、将来、さらなる機能が追加されるに連れて変更されるかもしれないことに注意してください。 管理者は、変更がないかリリースノートを確認するようにしてください。

表22.1 定義済みロール

<title>Predefined Roles</title>
ロール可能なアクセス
pg_read_all_data それらのオブジェクトに対するSELECT権限を持っていて、明示的に持っていなかったとしてもすべてのスキーマに対してUSAGE権限を持っているかのように、すべてのデータ(テーブル、ビュー、シーケンス)を読み取る。 このロールにはロール属性BYPASSRLSは設定されていません。 RLSが使われているのであれば、管理者はこのロールがGRANTされるロールに対してBYPASSRLSを設定したいと思うかもしれません。
pg_write_all_data それらのオブジェクトに対するINSERTUPDATEおよびDELETE権限を持っていて、明示的に持っていなかったとしてもすべてのスキーマに対してUSAGE権限を持っているかのように、すべてのデータ(テーブル、ビュー、シーケンス)に書き込む。 このロールにはロール属性BYPASSRLSは設定されていません。 RLSが使われているのであれば、管理者はこのロールがGRANTされるロールに対してBYPASSRLSを設定したいと思うかもしれません。
pg_read_all_settings通常スーパーユーザのみが読み取れる、全ての設定変数を読み取る
pg_read_all_stats通常スーパーユーザのみが読み取れる、すべてのpg_stat_*ビューを読み取り、各種の統計関連のエクステンションを使用する
pg_stat_scan_tables潜在的に長時間、テーブルのACCESS SHAREロックを取得する可能性がある監視機能を実行する
pg_monitor各種の監視ビューや機能を読み取り/実行する。 このロールは、pg_read_all_settingspg_read_all_statsおよびpg_stat_scan_tablesのメンバです。
pg_database_ownerなし。メンバ資格は暗黙に現在のデータベースの所有者から構成されます。
pg_signal_backend他のバックエンドに問い合わせのキャンセルやセッションの終了のシグナルを送信する
pg_read_server_filesCOPYやその他のファイルアクセス関数で、データベースがサーバ上でアクセスできる任意の場所からファイルを読み取ることを許可する
pg_write_server_filesCOPYやその他のファイルアクセス関数で、データベースがサーバ上でアクセスできる任意の場所にファイルを書き込むことを許可する
pg_execute_server_programCOPYやサーバ側のプログラムを実行できるその他の関数で、データベースを実行しているユーザとしてデータベースサーバ上でのプログラムの実行を許可する
pg_checkpointCHECKPOINTコマンドの実行を許可する
pg_use_reserved_connectionsreserved_connectionsによって予約済みの接続スロットの使用を許可する
pg_create_subscription CREATE SUBSCRIPTIONを実行するために、ユーザに対してデータベースへのCREATE権限を許可する

The <literal>pg_monitor</literal>, <literal>pg_read_all_settings</literal>, <literal>pg_read_all_stats</literal> and <literal>pg_stat_scan_tables</literal> roles are intended to allow administrators to easily configure a role for the purpose of monitoring the database server. They grant a set of common privileges allowing the role to read various useful configuration settings, statistics and other system information normally restricted to superusers. pg_monitorpg_read_all_settingspg_read_all_statsおよびpg_stat_scan_tablesロールは、データベースサーバを監視するためのロールを、管理者が簡単に設定できるようにする目的があります。 これらのロールは通常スーパーユーザに限定されている各種の有用な構成設定、統計情報およびその他のシステム情報を読むことができる一般的な権限のセットを与えることができます。

The <literal>pg_database_owner</literal> role has one implicit, situation-dependent member, namely the owner of the current database. Like any role, it can own objects or receive grants of access privileges. Consequently, once <literal>pg_database_owner</literal> has rights within a template database, each owner of a database instantiated from that template will exercise those rights. <literal>pg_database_owner</literal> cannot be a member of any role, and it cannot have non-implicit members. Initially, this role owns the <literal>public</literal> schema, so each database owner governs local use of the schema. pg_database_ownerロールには暗黙で状況に依存したメンバが1つあります。すなわち、現在のデータベースの所有者です。 他のロールと同様に、オブジェクトを所有したり、アクセス権限の許可を受けたりすることができます。 したがって、pg_database_ownerがテンプレートデータベース内で権限を一度持てば、そのテンプレートから作成されたデータベースの所有者は皆、その権限を行使します。 pg_database_ownerは他のロールのメンバにはなれませんし、暗黙でないメンバも持てません。 最初に、このロールはpublicスキーマを所有していますので、各データベース所有者はそのスキーマのローカルでの利用を管理します。

The <literal>pg_signal_backend</literal> role is intended to allow administrators to enable trusted, but non-superuser, roles to send signals to other backends. Currently this role enables sending of signals for canceling a query on another backend or terminating its session. A user granted this role cannot however send signals to a backend owned by a superuser. See <xref linkend="functions-admin-signal"/>. pg_signal_backendロールは、信頼はできるが非スーパーユーザであるロールが他のバックエンドにシグナルを送信することを、管理者が許可できるようにすることを意図しています。 今のところ、このロールは他のバックエンドでの問い合わせをキャンセルしたり、セッションを終了するシグナルを送信できます。 しかしながら、このロールの権限を与えられたユーザは、スーパーユーザが所有するバックエンドにシグナルを送信できません。 9.27.2を参照してください。

The <literal>pg_read_server_files</literal>, <literal>pg_write_server_files</literal> and <literal>pg_execute_server_program</literal> roles are intended to allow administrators to have trusted, but non-superuser, roles which are able to access files and run programs on the database server as the user the database runs as. As these roles are able to access any file on the server file system, they bypass all database-level permission checks when accessing files directly and they could be used to gain superuser-level access, therefore great care should be taken when granting these roles to users. pg_read_server_filespg_write_server_filespg_execute_server_programロールは、信頼はできるが非スーパーユーザであるロールがデータベースを実行しているユーザとしてデータベースサーバ上でファイルにアクセスしたりプログラムを実行したりすることを、管理者が許可できるようにすること意図しています。 これらのロールはサーバファイルシステムの任意のファイルにアクセスできますので、ファイルに直接アクセスする時にはデータベースレベルの権限検査はすべて行なわれず、スーパーユーザレベルのアクセスを得るのに使えます。ですので、これらのロールをユーザに許可する時には注意すべきです。

Care should be taken when granting these roles to ensure they are only used where needed and with the understanding that these roles grant access to privileged information. これらのロールを許可する場合は、必要な場合にのみ、これらのロールは機密情報へのアクセス権を与えることを理解して、使用されるように注意する必要があります。

Administrators can grant access to these roles to users using the <link linkend="sql-grant"><command>GRANT</command></link> command, for example: 管理者はGRANTコマンドを使って、ユーザにこれらのロールへのアクセスを許可できます。例えば、

GRANT pg_signal_backend TO admin_user;