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

DROP TYPE

DROP TYPE <refpurpose>remove a data type</refpurpose> — データ型を削除する

概要

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

説明

<title>Description</title>

<command>DROP TYPE</command> removes a user-defined data type. Only the owner of a type can remove it. DROP TYPEはユーザ定義のデータ型を削除します。 データ型を削除できるのは、その所有者のみです。

パラメータ

<title>Parameters</title>
IF EXISTS

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

name

The name (optionally schema-qualified) of the data type to remove. 削除するデータ型の名前です(スキーマ修飾名も可)。

CASCADE

Automatically drop objects that depend on the type (such as table columns, functions, and operators), and in turn all objects that depend on those objects (see <xref linkend="ddl-depend"/>). 削除するデータ型に依存するオブジェクト(テーブルの列、関数、演算子など)を自動的に削除し、さらにそれらのオブジェクトに依存するすべてのオブジェクトも削除します(5.14参照)。

RESTRICT

Refuse to drop the type if any objects depend on it. This is the default. 依存しているオブジェクトがある場合に、データ型の削除を拒否します。 こちらがデフォルトです。

<title>Examples</title>

To remove the data type <type>box</type>: boxデータ型を削除します。

DROP TYPE box;

互換性

<title>Compatibility</title>

This command is similar to the corresponding command in the SQL standard, apart from the <literal>IF EXISTS</literal> option, which is a <productname>PostgreSQL</productname> extension. But note that much of the <command>CREATE TYPE</command> command and the data type extension mechanisms in <productname>PostgreSQL</productname> differ from the SQL standard. このコマンドは、PostgreSQLの拡張であるIF EXISTSオプションを除き、標準SQL内の対応するコマンドと似ています。 しかし、PostgreSQLCREATE TYPEコマンドの多くとデータ型拡張機構は標準SQLとは異なる点に注意してください。

関連項目

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