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

23.5. データベースの削除 #

<title>Destroying a Database</title>

Databases are destroyed with the command <xref linkend="sql-dropdatabase"/>:<indexterm><primary>DROP DATABASE</primary></indexterm> データベースの削除には、以下のDROP DATABASEコマンドを使用します。

DROP DATABASE name;

Only the owner of the database, or a superuser, can drop a database. Dropping a database removes all objects that were contained within the database. The destruction of a database cannot be undone. データベースの所有者とスーパーユーザのみがデータベースを削除できます。 データベースの削除はそのデータベースに含まれるすべてのオブジェクトを削除します。 削除されたデータベースは復元できません。

You cannot execute the <command>DROP DATABASE</command> command while connected to the victim database. You can, however, be connected to any other database, including the <literal>template1</literal> database. <literal>template1</literal> would be the only option for dropping the last user database of a given cluster. 削除しようとしているデータベースに接続している時にはDROP DATABASEを実行することはできません。 しかし、template1などのその他のデータベースに接続すれば削除できます。 また、そのクラスタの最後のユーザデータベースを削除する時には、template1データベースに接続するしかありません。

For convenience, there is also a shell program to drop databases, <xref linkend="app-dropdb"/>:<indexterm><primary>dropdb</primary></indexterm> 利便性のため、データベースを削除するdropdbシェルプログラムもあります。

dropdb dbname

(Unlike <command>createdb</command>, it is not the default action to drop the database with the current user name.) createdbと異なり、デフォルトで現在のユーザ名のデータベースを削除するようにはなっていません。)