1
1
<!--
2
- $PostgreSQL: pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.47 2007/02/01 19:10:24 momjian Exp $
2
+ $PostgreSQL: pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.48 2008/03/28 00:21:55 tgl Exp $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -25,7 +25,7 @@ CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTE
25
25
EXECUTE PROCEDURE <replaceable class="PARAMETER">funcname</replaceable> ( <replaceable class="PARAMETER">arguments</replaceable> )
26
26
</synopsis>
27
27
</refsynopsisdiv>
28
-
28
+
29
29
<refsect1>
30
30
<title>Description</title>
31
31
@@ -65,6 +65,12 @@ CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTE
65
65
EACH STATEMENT</literal> triggers).
66
66
</para>
67
67
68
+ <para>
69
+ In addition, triggers may be defined to fire for a
70
+ <command>TRUNCATE</command>, though only
71
+ <literal>FOR EACH STATEMENT</literal>.
72
+ </para>
73
+
68
74
<para>
69
75
If multiple triggers of the same kind are defined for the same event,
70
76
they will be fired in alphabetical order by name.
@@ -80,7 +86,7 @@ CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTE
80
86
Refer to <xref linkend="triggers"> for more information about triggers.
81
87
</para>
82
88
</refsect1>
83
-
89
+
84
90
<refsect1>
85
91
<title>Parameters</title>
86
92
@@ -110,10 +116,10 @@ CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTE
110
116
<term><replaceable class="parameter">event</replaceable></term>
111
117
<listitem>
112
118
<para>
113
- One of <command>INSERT</command>, <command>UPDATE</command>, or
114
- <command>DELETE</command>; this specifies the event that will
115
- fire thetrigger. Multiple events can be specified using
116
- <literal>OR</literal>.
119
+ One of <command>INSERT</command>, <command>UPDATE</command>,
120
+ <command>DELETE</command>, or <command>TRUNCATE</command>;
121
+ this specifies theevent that will fire the trigger. Multiple
122
+ events can be specified using <literal>OR</literal>.
117
123
</para>
118
124
</listitem>
119
125
</varlistentry>
@@ -179,6 +185,11 @@ CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTE
179
185
<literal>TRIGGER</literal> privilege on the table.
180
186
</para>
181
187
188
+ <para>
189
+ Use <xref linkend="sql-droptrigger"
190
+ endterm="sql-droptrigger-title"> to remove a trigger.
191
+ </para>
192
+
182
193
<para>
183
194
In <productname>PostgreSQL</productname> versions before 7.3, it was
184
195
necessary to declare trigger functions as returning the placeholder
@@ -187,11 +198,6 @@ CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTE
187
198
declared as returning <type>opaque</>, but it will issue a notice and
188
199
change the function's declared return type to <type>trigger</>.
189
200
</para>
190
-
191
- <para>
192
- Use <xref linkend="sql-droptrigger"
193
- endterm="sql-droptrigger-title"> to remove a trigger.
194
- </para>
195
201
</refsect1>
196
202
197
203
<refsect1 id="R1-SQL-CREATETRIGGER-2">
@@ -204,7 +210,7 @@ CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTE
204
210
205
211
<refsect1 id="SQL-CREATETRIGGER-compatibility">
206
212
<title>Compatibility</title>
207
-
213
+
208
214
<para>
209
215
The <command>CREATE TRIGGER</command> statement in
210
216
<productname>PostgreSQL</productname> implements a subset of the
@@ -267,6 +273,12 @@ CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTE
267
273
<literal>OR</literal> is a <productname>PostgreSQL</> extension of
268
274
the SQL standard.
269
275
</para>
276
+
277
+ <para>
278
+ The ability to fire triggers for <command>TRUNCATE</command> is a
279
+ <productname>PostgreSQL</> extension of the SQL standard.
280
+ </para>
281
+
270
282
</refsect1>
271
283
272
284
<refsect1>