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

dropuser

dropuser <refpurpose>remove a <productname>PostgreSQL</productname> user account</refpurpose> PostgreSQLのユーザアカウントを削除する

概要

dropuser [connection-option...] [option...] [username]

説明

<title>Description</title>

<application>dropuser</application> removes an existing <productname>PostgreSQL</productname> user. Superusers can use this command to remove any role; otherwise, only non-superuser roles can be removed, and only by a user who possesses the <literal>CREATEROLE</literal> privilege and has been granted <literal>ADMIN OPTION</literal> on the target role. dropuserは、既存のPostgreSQLのユーザを削除します。 スーパーユーザはこのコマンドを使ってあらゆるロールを削除できます。それ以外の場合は、スーパーユーザ以外のロールのみが、CREATEROLE権限を持ち、対象のロールに対してADMIN OPTIONを付与されているユーザによってのみ削除されます。

<application>dropuser</application> is a wrapper around the <acronym>SQL</acronym> command <link linkend="sql-droprole"><command>DROP ROLE</command></link>. There is no effective difference between dropping users via this utility and via other methods for accessing the server. dropuserSQLコマンドDROP ROLEのラッパーです。 このユーティリティを使用してユーザを削除しても、この方法以外の方法でサーバでアクセスしてユーザを削除しても特に違いはありません。

オプション

<title>Options</title>

<application>dropuser</application> accepts the following command-line arguments: dropuserは、下記のコマンドライン引数を受け付けます。

username

Specifies the name of the <productname>PostgreSQL</productname> user to be removed. You will be prompted for a name if none is specified on the command line and the <option>-i</option>/<option>&#45;-interactive</option> option is used. 削除するPostgreSQLのユーザ名を指定します。 コマンドラインで指定されず、かつ-i/--interactiveオプションが使用されている場合は、入力を促すプロンプトが表示されます。

-e
--echo

Echo the commands that <application>dropuser</application> generates and sends to the server. dropuserが生成し、サーバに送信するコマンドを表示します。

-i
--interactive

Prompt for confirmation before actually removing the user, and prompt for the user name if none is specified on the command line. 実際にユーザを削除する前に確認のプロンプトを表示します。 コマンドラインにてユーザ名が指定されなかった場合にユーザ名の入力を促します。

-V
--version

Print the <application>dropuser</application> version and exit. dropuserのバージョンを表示し、終了します。

--if-exists

Do not throw an error if the user does not exist. A notice is issued in this case. ユーザが存在しない場合にエラーを発生しません。 この場合は注意が発生します。

-?
--help

Show help about <application>dropuser</application> command line arguments, and exit. dropuserのコマンドライン引数の使用方法を表示し、終了します。

<application>dropuser</application> also accepts the following command-line arguments for connection parameters: dropuserは以下のコマンドライン引数も接続パラメータとして受け付けます。

-h host
--host=host

Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. サーバが稼働しているマシンのホスト名を指定します。 この値がスラッシュから始まる場合、Unixドメインソケット用のディレクトリとして使用されます。

-p port
--port=port

Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. サーバが接続を監視するTCPポートもしくはUnixドメインソケットのファイル拡張子を指定します。

-U username
--username=username

User name to connect as (not the user name to drop). 接続に使用するユーザ名です (削除するユーザ名ではありません)。

-w
--no-password

Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <filename>.pgpass</filename> file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. パスワードの入力を促しません。 サーバがパスワード認証を必要とし、かつ、.pgpassファイルなどの他の方法が利用できない場合、接続試行は失敗します。 バッチジョブやスクリプトなどパスワードを入力するユーザが存在しない場合にこのオプションは有用かもしれません。

-W
--password

Force <application>dropuser</application> to prompt for a password before connecting to a database. データベースに接続する前に、dropuserは強制的にパスワード入力を促します。

This option is never essential, since <application>dropuser</application> will automatically prompt for a password if the server demands password authentication. However, <application>dropuser</application> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <option>-W</option> to avoid the extra connection attempt. サーバがパスワード認証を要求する場合dropuserは自動的にパスワード入力を促しますので、これが重要になることはありません。 しかし、dropuserは、サーバにパスワードが必要かどうかを判断するための接続試行を無駄に行います。 こうした余計な接続試行を防ぐために-Wの入力が有意となる場合もあります。

環境

<title>Environment</title>
PGHOST
PGPORT
PGUSER

Default connection parameters デフォルトの接続パラメータです。

PG_COLOR

Specifies whether to use color in diagnostic messages. Possible values are <literal>always</literal>, <literal>auto</literal> and <literal>never</literal>. 診断メッセージで色を使うかどうかを指定します。 可能な値はalwaysautoneverです。

This utility, like most other <productname>PostgreSQL</productname> utilities, also uses the environment variables supported by <application>libpq</application> (see <xref linkend="libpq-envars"/>). また、このユーティリティは、他のほとんどのPostgreSQLユーティリティと同様、libpqでサポートされる環境変数を使用します(34.15を参照してください)。

診断

<title>Diagnostics</title>

In case of difficulty, see <xref linkend="sql-droprole"/> and <xref linkend="app-psql"/> for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the <application>libpq</application> front-end library will apply. 問題が発生した場合、考えられる原因とエラーメッセージについてはDROP ROLEpsqlを参照してください。 データベースサーバは対象ホスト上で稼働していなければなりません。 また、libpqフロントエンドライブラリで使用される、あらゆるデフォルトの設定や環境変数が適用されます。

<title>Examples</title>

To remove user <literal>joe</literal> from the default database server: デフォルトのデータベースサーバから、ユーザjoeを削除します。

$ dropuser joe

To remove user <literal>joe</literal> using the server on host <literal>eden</literal>, port 5000, with verification and a peek at the underlying command: ホストedenでポート5000を使用しているサーバから、ユーザjoeを削除します。 このとき、背後で実行されるコマンドの表示と、削除前の確認をします。

$ dropuser -p 5000 -h eden -i -e joe
Role "joe" will be permanently removed.
Are you sure? (y/n) y
DROP ROLE joe;

関連項目

<title>See Also</title> createuser, DROP ROLE