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

DROP SCHEMA

DROP SCHEMA <refpurpose>remove a schema</refpurpose> — スキーマを削除する

概要

DROP SCHEMA [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

説明

<title>Description</title>

<command>DROP SCHEMA</command> removes schemas from the database. DROP SCHEMAはデータベースからスキーマを削除します。

A schema can only be dropped by its owner or a superuser. Note that the owner can drop the schema (and thereby all contained objects) even if they do not own some of the objects within the schema. スキーマを削除できるのは、所有者またはスーパーユーザのみです。 所有者は、スキーマ内に自分が所有していないオブジェクトが含まれていても、そのスキーマ(およびそこに含まれる全てのオブジェクト)を削除できます。

パラメータ

<title>Parameters</title>
IF EXISTS

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

name

The name of a schema. スキーマの名前です。

CASCADE

Automatically drop objects (tables, functions, etc.) that are contained in the schema, and in turn all objects that depend on those objects (see <xref linkend="ddl-depend"/>). スキーマに含まれるオブジェクト(テーブル、関数など)を自動的に削除し、さらにそれらのオブジェクトに依存するすべてのオブジェクトも削除します(5.14参照)。

RESTRICT

Refuse to drop the schema if it contains any objects. This is the default. スキーマにオブジェクトが含まれている場合は、スキーマの削除を拒否します。 こちらがデフォルトです。

注釈

<title>Notes</title>

Using the <literal>CASCADE</literal> option might make the command remove objects in other schemas besides the one(s) named. CASCADEオプションを使用すると、指定されたスキーマ以外にあるオブジェクトを削除することになる可能性があります。

<title>Examples</title>

To remove schema <literal>mystuff</literal> from the database, along with everything it contains: データベースからmystuffスキーマ、およびそこに含まれる全てのオブジェクトを削除します。

DROP SCHEMA mystuff CASCADE;

互換性

<title>Compatibility</title>

<command>DROP SCHEMA</command> is fully conforming with the SQL standard, except that the standard only allows one schema to be dropped per command, and apart from the <literal>IF EXISTS</literal> option, which is a <productname>PostgreSQL</productname> extension. 標準SQLでは一度のコマンド実行につき1つのスキーマしか削除できないという点を除き、および、PostgreSQLの拡張であるIF EXISTSを除き、DROP SCHEMAは、標準SQLと完全な互換性を持ちます。

関連項目

<title>See Also</title> ALTER SCHEMA, CREATE SCHEMA