dropdb <refpurpose>remove a <productname>PostgreSQL</productname> database</refpurpose> — PostgreSQLデータベースを削除する
dropdb [connection-option...] [option...]  dbname 
<application>dropdb</application> destroys an existing <productname>PostgreSQL</productname> database. The user who executes this command must be a database superuser or the owner of the database. dropdbは既存のPostgreSQLデータベースを削除します。 このコマンドを実行できるのは、データベースのスーパーユーザまたはデータベースの所有者のみです。
   <application>dropdb</application> is a wrapper around the
   <acronym>SQL</acronym> command <link linkend="sql-dropdatabase"><command>DROP DATABASE</command></link>.
   There is no effective difference between dropping databases via
   this utility and via other methods for accessing the server.
dropdbは、SQLコマンドDROP DATABASEのラッパーです。
このユーティリティを使用しても、これ以外の方法でサーバにアクセスして削除しても、特に違いはありません。
  
<application>dropdb</application> accepts the following command-line arguments: dropdbは、下記のコマンドライン引数を受け付けます。
dbnameSpecifies the name of the database to be removed. 削除するデータベース名を指定します。
-e--echoEcho the commands that <application>dropdb</application> generates and sends to the server. dropdbが生成し、サーバに送信するコマンドをエコー表示します。
-f--forceAttempt to terminate all existing connections to the target database before dropping it. See <xref linkend="sql-dropdatabase"/> for more information on this option. 削除の前に対象データベースへの既存の接続をすべて終了することを試みます。 このオプションに関する詳細な情報はDROP DATABASEを参照してください。
-i--interactiveIssues a verification prompt before doing anything destructive. 削除を行う前に、確認のためのプロンプトを表示します。
-V--versionPrint the <application>dropdb</application> version and exit. dropdbのバージョンを表示し、終了します。
--if-existsDo not throw an error if the database does not exist. A notice is issued in this case. 指定したデータベースが存在しない場合でもエラーとしません。 この場合には注意が発生します。
-?--helpShow help about <application>dropdb</application> command line arguments, and exit. dropdbのコマンドライン引数の使用方法を表示し、終了します。
<application>dropdb</application> also accepts the following command-line arguments for connection parameters: またdropdbは、以下のコマンドライン引数を接続パラメータとして受け付けます。
-h host--host=hostSpecifies 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=portSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. サーバが接続を監視するTCPポートもしくはUnixドメインソケットファイルの拡張子を指定します。
-U username--username=usernameUser name to connect as. 接続するユーザ名を指定します。
-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--passwordForce <application>dropdb</application> to prompt for a password before connecting to a database. データベースに接続する前に、dropdbは強制的にパスワード入力を促します。
        This option is never essential, since
        <application>dropdb</application> will automatically prompt
        for a password if the server demands password authentication.
        However, <application>dropdb</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.
サーバがパスワード認証を要求する場合dropdbは自動的にパスワード入力を促しますので、これが重要になることはありません。
しかし、dropdbは、サーバにパスワードが必要かどうかを判断するための接続試行を無駄に行います。
こうした余計な接続試行を防ぐために-Wの入力が有意となる場合もあります。
       
--maintenance-db=dbname
         Specifies the name of the database to connect to in order to drop the
         target database. If not specified, the <literal>postgres</literal>
         database will be used; if that does not exist (or is the database
         being dropped), <literal>template1</literal> will be used.
         This can be a <link linkend="libpq-connstring">connection
         string</link>.  If so, connection string parameters will override any
         conflicting command line options.
対象データベースを削除するために接続するデータベースの名前を指定します。
指定されない場合は、postgresデータベースが使用されます。
このデータベースが存在しない場合(またはこのデータベースが削除中である場合)template1が使用されます。
これは接続文字列でも構いません。
その場合、接続文字列パラメータは衝突するコマンドラインオプションよりも優先します。
       
PGHOSTPGPORTPGUSERDefault 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>.
診断メッセージで色を使うかどうかを指定します。
指定可能な値はalways、auto、neverです。
     
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がサポートする環境変数(32.15参照)も使います。
In case of difficulty, see <xref linkend="sql-dropdatabase"/> 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 DATABASEとpsqlを参照してください。 対象ホストでデータベースサーバが稼働していなければなりません。 また、libpqのフロントエンドライブラリの、あらゆるデフォルトの設定や環境変数が適用されます。
    To destroy the database <literal>demo</literal> on the default
    database server:
次のコマンドは、デフォルトのデータベースサーバ上のdemoデータベースを削除します。
$dropdb demo
    To destroy the database <literal>demo</literal> using the
    server on host <literal>eden</literal>, port 5000, with verification and a peek
    at the underlying command:
次のコマンドはホストedenのポート番号5000で動作しているサーバからデータベースdemoを削除します。
その際、削除を確認し、またバックエンドに送られるコマンドを表示します。
$dropdb -p 5000 -h eden -i -e demoDatabase "demo" will be permanently deleted. Are you sure? (y/n)yDROP DATABASE demo;