Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4d16001

Browse files
committed
Improve documentation for CREATE CONSTRAINT TRIGGER.
1 parent9335711 commit4d16001

File tree

2 files changed

+49
-24
lines changed

2 files changed

+49
-24
lines changed

‎doc/src/sgml/ref/create_constraint.sgml

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/create_constraint.sgml,v 1.17 2006/10/17 12:53:03 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/create_constraint.sgml,v 1.18 2007/02/10 20:43:59 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -15,13 +15,13 @@ PostgreSQL documentation
1515
</refnamediv>
1616

1717
<indexterm zone="sql-createconstraint">
18-
<primary>CREATE CONSTRAINT</primary>
18+
<primary>CREATE CONSTRAINT TRIGGER</primary>
1919
</indexterm>
2020

2121
<refsynopsisdiv>
2222
<synopsis>
2323
CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
24-
AFTER <replaceable class="parameter">event [ OR ... ]</replaceable>
24+
AFTER <replaceable class="parameter">event</replaceable> [ OR ... ]
2525
ON <replaceable class="parameter">table_name</replaceable>
2626
[ FROM <replaceable class="parameter">referenced_table_name</replaceable> ]
2727
{ NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } }
@@ -34,27 +34,30 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
3434
<title>Description</title>
3535

3636
<para>
37-
<command>CREATE CONSTRAINT TRIGGER</command> is used within
38-
<command>CREATE TABLE</command>/<command>ALTER TABLE</command> and by
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>
37+
<command>CREATE CONSTRAINT TRIGGER</command> creates a
38+
<firstterm>constraint trigger</>. This is the same as a regular trigger
39+
except that the timing of the trigger firing can be adjusted using
40+
<xref linkend="SQL-SET-CONSTRAINTS" endterm="SQL-SET-CONSTRAINTS-TITLE">.
41+
Constraint triggers must be <literal>AFTER ROW</> triggers. They can
42+
be fired either at the end of the statement causing the triggering event,
43+
or at the end of the containing transaction; in the latter case they are
44+
said to be <firstterm>deferred</>. A pending deferred-trigger firing can
45+
also be forced to happen immediately by using <command>SET CONSTRAINTS</>.
46+
</para>
47+
</refsect1>
4448

45-
<refsect1>
49+
<refsect1>
4650
<title>Parameters</title>
4751

4852
<variablelist>
4953
<varlistentry>
5054
<term><replaceable class="PARAMETER">name</replaceable></term>
5155
<listitem>
5256
<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 when dropping the trigger.
57+
The name of the constraint trigger. This is also the name to use
58+
when modifying the trigger's behavior using <command>SET CONSTRAINTS</>.
59+
The name cannot be schema-qualified &mdash; the trigger inherits the
60+
schema of its table.
5861
</para>
5962
</listitem>
6063
</varlistentry>
@@ -84,8 +87,9 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
8487
<term><replaceable class="PARAMETER">referenced_table_name</replaceable></term>
8588
<listitem>
8689
<para>
87-
The (possibly schema-qualified) name of the table referenced by the
88-
constraint. Used by foreign key constraints triggers.
90+
The (possibly schema-qualified) name of another table referenced by the
91+
constraint. This option is used for foreign-key constraints and is not
92+
recommended for general use.
8993
</para>
9094
</listitem>
9195
</varlistentry>
@@ -97,17 +101,29 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
97101
<term><literal>INITIALLY DEFERRED</literal></term>
98102
<listitem>
99103
<para>
104+
The default timing of the trigger.
100105
See the <xref linkend="SQL-CREATETABLE" endterm="SQL-CREATETABLE-TITLE">
101106
documentation for details of these constraint options.
102107
</para>
103108
</listitem>
104109
</varlistentry>
105110

106111
<varlistentry>
107-
<term><replaceable class="PARAMETER">funcname</replaceable>(<replaceable class="PARAMETER">args</replaceable>)</term>
112+
<term><replaceable class="PARAMETER">funcname</replaceable></term>
108113
<listitem>
109114
<para>
110-
The function to call as part of the trigger processing. See <xref
115+
The function to call when the trigger is fired. See <xref
116+
linkend="SQL-CREATETRIGGER" endterm="SQL-CREATETRIGGER-TITLE"> for
117+
details.
118+
</para>
119+
</listitem>
120+
</varlistentry>
121+
122+
<varlistentry>
123+
<term><replaceable class="PARAMETER">arguments</replaceable></term>
124+
<listitem>
125+
<para>
126+
Optional argument strings to pass to the trigger function. See <xref
111127
linkend="SQL-CREATETRIGGER" endterm="SQL-CREATETRIGGER-TITLE"> for
112128
details.
113129
</para>
@@ -119,11 +135,19 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
119135
<refsect1>
120136
<title>Compatibility</title>
121137
<para>
122-
<command>CREATECONTRAINT TRIGGER</command> is a
138+
<command>CREATECONSTRAINT TRIGGER</command> is a
123139
<productname>PostgreSQL</productname> extension of the <acronym>SQL</>
124140
standard.
125141
</para>
126142
</refsect1>
127143

128-
</refentry>
144+
<refsect1>
145+
<title>See Also</title>
129146

147+
<simplelist type="inline">
148+
<member><xref linkend="sql-createtrigger" endterm="sql-createtrigger-title"></member>
149+
<member><xref linkend="sql-droptrigger" endterm="sql-droptrigger-title"></member>
150+
<member><xref linkend="sql-set-constraints" endterm="sql-set-constraints-title"></member>
151+
</simplelist>
152+
</refsect1>
153+
</refentry>

‎doc/src/sgml/ref/set_constraints.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.14 2006/09/16 00:30:20 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.15 2007/02/10 20:43:59 tgl Exp $ -->
22
<refentry id="SQL-SET-CONSTRAINTS">
33
<refmeta>
44
<refentrytitle id="SQL-SET-CONSTRAINTS-title">SET CONSTRAINTS</refentrytitle>
@@ -67,7 +67,8 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
6767
<para>
6868
Currently, only foreign key constraints are affected by this
6969
setting. Check and unique constraints are always effectively
70-
not deferrable.
70+
not deferrable. Triggers that are declared as <quote>constraint
71+
triggers</> are also affected.
7172
</para>
7273
</refsect1>
7374

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp