| 1 |
<!-- |
| 2 |
doc/src/sgml/ref/drop_trigger.sgml |
| 3 |
PostgreSQL documentation |
| 4 |
--> |
| 5 |
|
| 6 |
<refentry id="sql-droptrigger"> |
| 7 |
<indexterm zone="sql-droptrigger"> |
| 8 |
<primary>DROP TRIGGER</primary> |
| 9 |
</indexterm> |
| 10 |
|
| 11 |
<refmeta> |
| 12 |
<refentrytitle>DROP TRIGGER</refentrytitle> |
| 13 |
<manvolnum>7</manvolnum> |
| 14 |
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 15 |
</refmeta> |
| 16 |
|
| 17 |
<refnamediv> |
| 18 |
<refname>DROP TRIGGER</refname> |
| 19 |
<refpurpose>remove a trigger</refpurpose> |
| 20 |
</refnamediv> |
| 21 |
|
| 22 |
<refsynopsisdiv> |
| 23 |
<synopsis> |
| 24 |
DROP TRIGGER [ IF EXISTS ] <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable> [ CASCADE | RESTRICT ] |
| 25 |
</synopsis> |
| 26 |
</refsynopsisdiv> |
| 27 |
|
| 28 |
<refsect1> |
| 29 |
<title>Description</title> |
| 30 |
|
| 31 |
<para> |
| 32 |
<command>DROP TRIGGER</command> removes an existing |
| 33 |
trigger definition. To execute this command, the current |
| 34 |
user must be the owner of the table for which the trigger is defined. |
| 35 |
</para> |
| 36 |
</refsect1> |
| 37 |
|
| 38 |
<refsect1> |
| 39 |
<title>Parameters</title> |
| 40 |
|
| 41 |
<variablelist> |
| 42 |
|
| 43 |
<varlistentry> |
| 44 |
<term><literal>IF EXISTS</literal></term> |
| 45 |
<listitem> |
| 46 |
<para> |
| 47 |
Do not throw an error if the trigger does not exist. A notice is issued |
| 48 |
in this case. |
| 49 |
</para> |
| 50 |
</listitem> |
| 51 |
</varlistentry> |
| 52 |
|
| 53 |
<varlistentry> |
| 54 |
<term><replaceable class="parameter">name</replaceable></term> |
| 55 |
<listitem> |
| 56 |
<para> |
| 57 |
The name of the trigger to remove. |
| 58 |
</para> |
| 59 |
</listitem> |
| 60 |
</varlistentry> |
| 61 |
|
| 62 |
<varlistentry> |
| 63 |
<term><replaceable class="parameter">table_name</replaceable></term> |
| 64 |
<listitem> |
| 65 |
<para> |
| 66 |
The name (optionally schema-qualified) of the table for which |
| 67 |
the trigger is defined. |
| 68 |
</para> |
| 69 |
</listitem> |
| 70 |
</varlistentry> |
| 71 |
|
| 72 |
<varlistentry> |
| 73 |
<term><literal>CASCADE</literal></term> |
| 74 |
<listitem> |
| 75 |
<para> |
| 76 |
Automatically drop objects that depend on the trigger, |
| 77 |
and in turn all objects that depend on those objects |
| 78 |
(see <xref linkend="ddl-depend"/>). |
| 79 |
</para> |
| 80 |
</listitem> |
| 81 |
</varlistentry> |
| 82 |
|
| 83 |
<varlistentry> |
| 84 |
<term><literal>RESTRICT</literal></term> |
| 85 |
<listitem> |
| 86 |
<para> |
| 87 |
Refuse to drop the trigger if any objects depend on it. This is |
| 88 |
the default. |
| 89 |
</para> |
| 90 |
</listitem> |
| 91 |
</varlistentry> |
| 92 |
</variablelist> |
| 93 |
</refsect1> |
| 94 |
|
| 95 |
<refsect1 id="sql-droptrigger-examples"> |
| 96 |
<title>Examples</title> |
| 97 |
|
| 98 |
<para> |
| 99 |
Destroy the trigger <literal>if_dist_exists</literal> on the table |
| 100 |
<literal>films</literal>: |
| 101 |
|
| 102 |
<programlisting> |
| 103 |
DROP TRIGGER if_dist_exists ON films; |
| 104 |
</programlisting></para> |
| 105 |
</refsect1> |
| 106 |
|
| 107 |
<refsect1 id="sql-droptrigger-compatibility"> |
| 108 |
<title>Compatibility</title> |
| 109 |
|
| 110 |
<para> |
| 111 |
The <command>DROP TRIGGER</command> statement in |
| 112 |
<productname>PostgreSQL</productname> is incompatible with the SQL |
| 113 |
standard. In the SQL standard, trigger names are not local to |
| 114 |
tables, so the command is simply <literal>DROP TRIGGER |
| 115 |
<replaceable>name</replaceable></literal>. |
| 116 |
</para> |
| 117 |
</refsect1> |
| 118 |
|
| 119 |
<refsect1> |
| 120 |
<title>See Also</title> |
| 121 |
|
| 122 |
<simplelist type="inline"> |
| 123 |
<member><xref linkend="sql-createtrigger"/></member> |
| 124 |
</simplelist> |
| 125 |
</refsect1> |
| 126 |
|
| 127 |
</refentry> |