1
1
<!--
2
- $PostgreSQL: pgsql/doc/src/sgml/ref/create_constraint.sgml,v 1.14 2006/09 /1600 :30:17 momjian Exp $
2
+ $PostgreSQL: pgsql/doc/src/sgml/ref/create_constraint.sgml,v 1.15 2006/10 /1619 :30:09 momjian Exp $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -21,9 +21,12 @@ PostgreSQL documentation
21
21
<refsynopsisdiv>
22
22
<synopsis>
23
23
CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
24
- AFTER <replaceable class="parameter">events</replaceable> ON
25
- <replaceable class="parameter">tablename</replaceable> <replaceable class="parameter">constraint</replaceable> <replaceable class="parameter">attributes</replaceable>
26
- FOR EACH ROW EXECUTE PROCEDURE <replaceable class="parameter">funcname</replaceable> ( <replaceable class="parameter">args</replaceable> )
24
+ AFTER <replaceable class="parameter">event [ OR ... ]</replaceable>
25
+ ON <replaceable class="parameter">table_name</replaceable>
26
+ [ FROM <replaceable class="parameter">referenced_table_name</replaceable> ]
27
+ { NOT DEFERRABLE | [ DEFERABBLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } }
28
+ FOR EACH ROW
29
+ EXECUTE PROCEDURE <replaceable class="parameter">funcname</replaceable> ( <replaceable class="parameter">arguments</replaceable> )
27
30
</synopsis>
28
31
</refsynopsisdiv>
29
32
@@ -33,70 +36,94 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
33
36
<para>
34
37
<command>CREATE CONSTRAINT TRIGGER</command> is used within
35
38
<command>CREATE TABLE</command>/<command>ALTER TABLE</command> and by
36
- <application>pg_dump</application> to create the special triggers for
37
- referential integrity.
38
- It is not intended for general use.
39
- </para>
40
- </refsect1>
39
+ <application>pg_dump</application> to create the special triggers for
40
+ referential integrity.
41
+ It is not intended for general use.
42
+ </para>
43
+ </refsect1>
44
+
45
+ <refsect1>
46
+ <title>Parameters</title>
47
+
48
+ <variablelist>
49
+ <varlistentry>
50
+ <term><replaceable class="PARAMETER">name</replaceable></term>
51
+ <listitem>
52
+ <para>
53
+ The name of the constraint trigger. The actual name of the
54
+ created trigger will be of the form
55
+ <literal>RI_ConstraintTrigger_0000<literal> (where 0000 is some number
56
+ assigned by the server).
57
+ Use this assigned name is when dropping the constraint.
58
+ </para>
59
+ </listitem>
60
+ </varlistentry>
61
+
62
+ <varlistentry>
63
+ <term><replaceable class="PARAMETER">events</replaceable></term>
64
+ <listitem>
65
+ <para>
66
+ One of <literal>INSERT</literal>, <literal>UPDATE</literal>, or
67
+ <literal>DELETE</literal>; this specifies the event that will fire the
68
+ trigger. Multiple events can be specified using <literal>OR<literal>.
69
+ </para>
70
+ </listitem>
71
+ </varlistentry>
72
+
73
+ <varlistentry>
74
+ <term><replaceable class="PARAMETER">table_name</replaceable></term>
75
+ <listitem>
76
+ <para>
77
+ The (possibly schema-qualified) name of the table in which
78
+ the triggering events occur.
79
+ </para>
80
+ </listitem>
81
+ </varlistentry>
82
+
83
+ <varlistentry>
84
+ <term><replaceable class="PARAMETER">referenced_table_name</replaceable></term>
85
+ <listitem>
86
+ <para>
87
+ The (possibly schema-qualified) name of the table referenced by the
88
+ constraint. Used by foreign key constraints triggers.
89
+ </para>
90
+ </listitem>
91
+ </varlistentry>
92
+
93
+ <varlistentry>
94
+ <term><literal>DEFERRABLE</literal></term>
95
+ <term><literal>NOT DEFERRABLE</literal></term>
96
+ <term><literal>INITIALLY IMMEDIATE</literal></term>
97
+ <term><literal>INITIALLY DEFERRED</literal></term>
98
+ <listitem>
99
+ <para>
100
+ See the <xref linkend="SQL-CREATETABLE" endterm="SQL-CREATETABLE-TITLE">
101
+ documentation for details of these constraint options.
102
+ </para>
103
+ </listitem>
104
+ </varlistentry>
105
+
106
+ <varlistentry>
107
+ <term><replaceable class="PARAMETER">funcname</replaceable>(<replaceable class="PARAMETER">args</replaceable>)</term>
108
+ <listitem>
109
+ <para>
110
+ The function to call as part of the trigger processing. See <xref
111
+ linkend="SQL-CREATETRIGGER" endterm="SQL-CREATETRIGGER-TITLE"> for
112
+ details.
113
+ </para>
114
+ </listitem>
115
+ </varlistentry>
116
+ </variablelist>
117
+ </refsect1>
41
118
42
119
<refsect1>
43
- <title>Parameters</title>
44
-
45
- <variablelist>
46
- <varlistentry>
47
- <term><replaceable class="PARAMETER">name</replaceable></term>
48
- <listitem>
49
- <para>
50
- The name of the constraint trigger.
51
- </para>
52
- </listitem>
53
- </varlistentry>
54
-
55
- <varlistentry>
56
- <term><replaceable class="PARAMETER">events</replaceable></term>
57
- <listitem>
58
- <para>
59
- The event categories for which this trigger should be fired.
60
- </para>
61
- </listitem>
62
- </varlistentry>
63
-
64
- <varlistentry>
65
- <term><replaceable class="PARAMETER">tablename</replaceable></term>
66
- <listitem>
67
- <para>
68
- The name (possibly schema-qualified) of the table in which
69
- the triggering events occur.
70
- </para>
71
- </listitem>
72
- </varlistentry>
73
-
74
- <varlistentry>
75
- <term><replaceable class="PARAMETER">constraint</replaceable></term>
76
- <listitem>
77
- <para>
78
- Actual constraint specification.
79
- </para>
80
- </listitem>
81
- </varlistentry>
82
-
83
- <varlistentry>
84
- <term><replaceable class="PARAMETER">attributes</replaceable></term>
85
- <listitem>
86
- <para>
87
- The constraint attributes.
88
- </para>
89
- </listitem>
90
- </varlistentry>
91
-
92
- <varlistentry>
93
- <term><replaceable class="PARAMETER">funcname</replaceable>(<replaceable class="PARAMETER">args</replaceable>)</term>
94
- <listitem>
95
- <para>
96
- The function to call as part of the trigger processing.
97
- </para>
98
- </listitem>
99
- </varlistentry>
100
- </variablelist>
120
+ <title>Compatibility</title>
121
+ <para>
122
+ <command>CREATE CONTRAINT TRIGGER</command> is a
123
+ <productname>PostgreSQL</productname> extension of the <acronym>SQL</>
124
+ standard.
125
+ </para>
101
126
</refsect1>
102
- </refentry>
127
+
128
+ </refentry>
129
+