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

DROP TRIGGER

DROP TRIGGER <refpurpose>remove a trigger</refpurpose> — トリガを削除する

概要

DROP TRIGGER [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]

説明

<title>Description</title>

<command>DROP TRIGGER</command> removes an existing trigger definition. To execute this command, the current user must be the owner of the table for which the trigger is defined. DROP TRIGGERは既存のトリガ定義を削除します。 このコマンドを実行できるのは、トリガが定義されたテーブルの所有者のみです。

パラメータ

<title>Parameters</title>
IF EXISTS

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

name

The name of the trigger to remove. 削除するトリガの名前です。

table_name

The name (optionally schema-qualified) of the table for which the trigger is defined. トリガが定義されたテーブルの名前です(スキーマ修飾名も可)。

CASCADE

Automatically drop objects that depend on the trigger, and in turn all objects that depend on those objects (see <xref linkend="ddl-depend"/>). このトリガに依存しているオブジェクトを自動的に削除し、さらにそれらのオブジェクトに依存するすべてのオブジェクトも削除します(5.14参照)。

RESTRICT

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

<title>Examples</title>

Destroy the trigger <literal>if_dist_exists</literal> on the table <literal>films</literal>: テーブルfilmsにあるトリガif_dist_existsを削除します。

DROP TRIGGER if_dist_exists ON films;

互換性

<title>Compatibility</title>

The <command>DROP TRIGGER</command> statement in <productname>PostgreSQL</productname> is incompatible with the SQL standard. In the SQL standard, trigger names are not local to tables, so the command is simply <literal>DROP TRIGGER <replaceable>name</replaceable></literal>. PostgreSQLDROP TRIGGER文には標準SQLとの互換性がありません。 標準SQLでは、トリガ名がテーブルに局所化されていないので、DROP TRIGGER nameというコマンドが使われています。

関連項目

<title>See Also</title> CREATE TRIGGER