1<!-- 2doc/src/sgml/ref/alter_trigger.sgml 3PostgreSQL documentation 4--> 5 6<refentry id="sql-altertrigger"> 7 <indexterm zone="sql-altertrigger"> 8 <primary>ALTER TRIGGER</primary> 9 </indexterm> 10 11 <refmeta> 12 <refentrytitle>ALTER TRIGGER</refentrytitle> 13 <manvolnum>7</manvolnum> 14 <refmiscinfo>SQL - Language Statements</refmiscinfo> 15 </refmeta> 16 17 <refnamediv> 18 <refname>ALTER TRIGGER</refname> 19 <refpurpose>change the definition of a trigger</refpurpose> 20 </refnamediv> 21 22 <refsynopsisdiv> 23<synopsis> 24ALTER TRIGGER <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable> 25ALTER TRIGGER <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable> [ NO ] DEPENDS ON EXTENSION <replaceable class="parameter">extension_name</replaceable> 26</synopsis> 27 </refsynopsisdiv> 28 29 <refsect1> 30 <title>Description</title> 31 32 <para> 33 <command>ALTER TRIGGER</command> changes properties of an existing 34 trigger. The <literal>RENAME</literal> clause changes the name of 35 the given trigger without otherwise changing the trigger 36 definition. The <literal>DEPENDS ON EXTENSION</literal> clause marks 37 the trigger as dependent on an extension, such that if the extension is 38 dropped, the trigger will automatically be dropped as well. 39 </para> 40 41 <para> 42 You must own the table on which the trigger acts to be allowed to change its properties. 43 </para> 44 </refsect1> 45 46 <refsect1> 47 <title>Parameters</title> 48 49 <variablelist> 50 <varlistentry> 51 <term><replaceable class="parameter">name</replaceable></term> 52 <listitem> 53 <para> 54 The name of an existing trigger to alter. 55 </para> 56 </listitem> 57 </varlistentry> 58 59 <varlistentry> 60 <term><replaceable class="parameter">table_name</replaceable></term> 61 <listitem> 62 <para> 63 The name of the table on which this trigger acts. 64 </para> 65 </listitem> 66 </varlistentry> 67 68 <varlistentry> 69 <term><replaceable class="parameter">new_name</replaceable></term> 70 <listitem> 71 <para> 72 The new name for the trigger. 73 </para> 74 </listitem> 75 </varlistentry> 76 77 <varlistentry> 78 <term><replaceable class="parameter">extension_name</replaceable></term> 79 <listitem> 80 <para> 81 The name of the extension that the trigger is to depend on (or no longer 82 dependent on, if <literal>NO</literal> is specified). A trigger 83 that's marked as dependent on an extension is automatically dropped when 84 the extension is dropped. 85 </para> 86 </listitem> 87 </varlistentry> 88 </variablelist> 89 </refsect1> 90 91 <refsect1> 92 <title>Notes</title> 93 94 <para> 95 The ability to temporarily enable or disable a trigger is provided by 96 <xref linkend="sql-altertable"/>, not by 97 <command>ALTER TRIGGER</command>, because <command>ALTER TRIGGER</command> has no 98 convenient way to express the option of enabling or disabling all of 99 a table's triggers at once. 100 </para> 101 </refsect1> 102 103 <refsect1> 104 <title>Examples</title> 105 106 <para> 107 To rename an existing trigger: 108<programlisting> 109ALTER TRIGGER emp_stamp ON emp RENAME TO emp_track_chgs; 110</programlisting></para> 111 112 <para> 113 To mark a trigger as being dependent on an extension: 114<programlisting> 115ALTER TRIGGER emp_stamp ON emp DEPENDS ON EXTENSION emplib; 116</programlisting></para> 117 </refsect1> 118 119 <refsect1> 120 <title>Compatibility</title> 121 122 <para> 123 <command>ALTER TRIGGER</command> is a <productname>PostgreSQL</productname> 124 extension of the SQL standard. 125 </para> 126 </refsect1> 127 128 <refsect1> 129 <title>See Also</title> 130 131 <simplelist type="inline"> 132 <member><xref linkend="sql-altertable"/></member> 133 </simplelist> 134 </refsect1> 135</refentry> 136