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

DROP ROLE

DROP ROLE <refpurpose>remove a database role</refpurpose> — データベースロールを削除する

概要

DROP ROLE [ IF EXISTS ] name [, ...]

説明

<title>Description</title>

<command>DROP ROLE</command> removes the specified role(s). To drop a superuser role, you must be a superuser yourself; to drop non-superuser roles, you must have <literal>CREATEROLE</literal> privilege and have been granted <literal>ADMIN OPTION</literal> on the role. DROP ROLEは指定したロール(複数可)を削除します。 スーパーユーザロールを削除するには、自身もスーパーユーザでなければなりません。 スーパーユーザ以外のロールを削除するには、CREATEROLE権限を持ち、そのロールに対してADMIN OPTIONが付与されていなければなりません。

A role cannot be removed if it is still referenced in any database of the cluster; an error will be raised if so. Before dropping the role, you must drop all the objects it owns (or reassign their ownership) and revoke any privileges the role has been granted on other objects. The <link linkend="sql-reassign-owned"><command>REASSIGN OWNED</command></link> and <link linkend="sql-drop-owned"><command>DROP OWNED</command></link> commands can be useful for this purpose; see <xref linkend="role-removal"/> for more discussion. データベースクラスタのいずれかから参照されている場合、ロールを削除することができません。 削除しようとしてもエラーとなります。 ロールを削除する前に、そのロールが所有するオブジェクトすべてを削除(またはその所有権を変更)しなければなりません。 また、そのロールが他のオブジェクトについて付与された権限も取り消されなければなりません。 この目的のためにはREASSIGN OWNEDおよびDROP OWNEDコマンドが有用です。 詳しくは22.4を参照して下さい。

However, it is not necessary to remove role memberships involving the role; <command>DROP ROLE</command> automatically revokes any memberships of the target role in other roles, and of other roles in the target role. The other roles are not dropped nor otherwise affected. しかし、ロール内のロールメンバ資格を削除する必要はありません。 DROP ROLEは自動的に他のロール内にある対象ロールのメンバ資格を取り消します。 他のロールは削除されることも何らかの影響を受けることもありません。

パラメータ

<title>Parameters</title>
IF EXISTS

Do not throw an error if the role does not exist. A notice is issued in this case. ロールが存在しない場合でもエラーになりません。 この場合注意メッセージが発行されます。

name

The name of the role to remove. 削除対象のロールの名前です。

注釈

<title>Notes</title>

<productname>PostgreSQL</productname> includes a program <xref linkend="app-dropuser"/> that has the same functionality as this command (in fact, it calls this command) but can be run from the command shell. PostgreSQLには、このコマンドと同じ機能を持つプログラムdropuserがあります。 (実際には、このプログラムはこのコマンドを呼び出しています。) こちらはコマンドシェルから実行することができます。

<title>Examples</title>

To drop a role: ロールを削除します。

DROP ROLE jonathan;

互換性

<title>Compatibility</title>

The SQL standard defines <command>DROP ROLE</command>, but it allows only one role to be dropped at a time, and it specifies different privilege requirements than <productname>PostgreSQL</productname> uses. 標準SQLではDROP ROLEを定義していますが、一度に1つのロールしか削除することができません。 また、PostgreSQLとは異なる権限が必要であると規定しています。

関連項目

<title>See Also</title> CREATE ROLE, ALTER ROLE, SET ROLE