Improve documentation for CREATE CONSTRAINT TRIGGER.
This commit is contained in:
parent
933571129d
commit
4d160018d2
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_constraint.sgml,v 1.17 2006/10/17 12:53:03 momjian Exp $
|
$PostgreSQL: pgsql/doc/src/sgml/ref/create_constraint.sgml,v 1.18 2007/02/10 20:43:59 tgl Exp $
|
||||||
PostgreSQL documentation
|
PostgreSQL documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -15,13 +15,13 @@ PostgreSQL documentation
|
|||||||
</refnamediv>
|
</refnamediv>
|
||||||
|
|
||||||
<indexterm zone="sql-createconstraint">
|
<indexterm zone="sql-createconstraint">
|
||||||
<primary>CREATE CONSTRAINT</primary>
|
<primary>CREATE CONSTRAINT TRIGGER</primary>
|
||||||
</indexterm>
|
</indexterm>
|
||||||
|
|
||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<synopsis>
|
<synopsis>
|
||||||
CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
|
CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
|
||||||
AFTER <replaceable class="parameter">event [ OR ... ]</replaceable>
|
AFTER <replaceable class="parameter">event</replaceable> [ OR ... ]
|
||||||
ON <replaceable class="parameter">table_name</replaceable>
|
ON <replaceable class="parameter">table_name</replaceable>
|
||||||
[ FROM <replaceable class="parameter">referenced_table_name</replaceable> ]
|
[ FROM <replaceable class="parameter">referenced_table_name</replaceable> ]
|
||||||
{ NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } }
|
{ NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } }
|
||||||
@ -34,15 +34,19 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
|
|||||||
<title>Description</title>
|
<title>Description</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<command>CREATE CONSTRAINT TRIGGER</command> is used within
|
<command>CREATE CONSTRAINT TRIGGER</command> creates a
|
||||||
<command>CREATE TABLE</command>/<command>ALTER TABLE</command> and by
|
<firstterm>constraint trigger</>. This is the same as a regular trigger
|
||||||
<application>pg_dump</application> to create the special triggers for
|
except that the timing of the trigger firing can be adjusted using
|
||||||
referential integrity.
|
<xref linkend="SQL-SET-CONSTRAINTS" endterm="SQL-SET-CONSTRAINTS-TITLE">.
|
||||||
It is not intended for general use.
|
Constraint triggers must be <literal>AFTER ROW</> triggers. They can
|
||||||
</para>
|
be fired either at the end of the statement causing the triggering event,
|
||||||
</refsect1>
|
or at the end of the containing transaction; in the latter case they are
|
||||||
|
said to be <firstterm>deferred</>. A pending deferred-trigger firing can
|
||||||
|
also be forced to happen immediately by using <command>SET CONSTRAINTS</>.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Parameters</title>
|
<title>Parameters</title>
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
@ -50,11 +54,10 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
|
|||||||
<term><replaceable class="PARAMETER">name</replaceable></term>
|
<term><replaceable class="PARAMETER">name</replaceable></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
The name of the constraint trigger. The actual name of the
|
The name of the constraint trigger. This is also the name to use
|
||||||
created trigger will be of the form
|
when modifying the trigger's behavior using <command>SET CONSTRAINTS</>.
|
||||||
<literal>RI_ConstraintTrigger_0000</literal> (where 0000 is some number
|
The name cannot be schema-qualified — the trigger inherits the
|
||||||
assigned by the server).
|
schema of its table.
|
||||||
Use this assigned name when dropping the trigger.
|
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@ -84,8 +87,9 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
|
|||||||
<term><replaceable class="PARAMETER">referenced_table_name</replaceable></term>
|
<term><replaceable class="PARAMETER">referenced_table_name</replaceable></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
The (possibly schema-qualified) name of the table referenced by the
|
The (possibly schema-qualified) name of another table referenced by the
|
||||||
constraint. Used by foreign key constraints triggers.
|
constraint. This option is used for foreign-key constraints and is not
|
||||||
|
recommended for general use.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@ -97,6 +101,7 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
|
|||||||
<term><literal>INITIALLY DEFERRED</literal></term>
|
<term><literal>INITIALLY DEFERRED</literal></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
|
The default timing of the trigger.
|
||||||
See the <xref linkend="SQL-CREATETABLE" endterm="SQL-CREATETABLE-TITLE">
|
See the <xref linkend="SQL-CREATETABLE" endterm="SQL-CREATETABLE-TITLE">
|
||||||
documentation for details of these constraint options.
|
documentation for details of these constraint options.
|
||||||
</para>
|
</para>
|
||||||
@ -104,10 +109,21 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><replaceable class="PARAMETER">funcname</replaceable>(<replaceable class="PARAMETER">args</replaceable>)</term>
|
<term><replaceable class="PARAMETER">funcname</replaceable></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
The function to call as part of the trigger processing. See <xref
|
The function to call when the trigger is fired. See <xref
|
||||||
|
linkend="SQL-CREATETRIGGER" endterm="SQL-CREATETRIGGER-TITLE"> for
|
||||||
|
details.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><replaceable class="PARAMETER">arguments</replaceable></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Optional argument strings to pass to the trigger function. See <xref
|
||||||
linkend="SQL-CREATETRIGGER" endterm="SQL-CREATETRIGGER-TITLE"> for
|
linkend="SQL-CREATETRIGGER" endterm="SQL-CREATETRIGGER-TITLE"> for
|
||||||
details.
|
details.
|
||||||
</para>
|
</para>
|
||||||
@ -119,11 +135,19 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
|
|||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Compatibility</title>
|
<title>Compatibility</title>
|
||||||
<para>
|
<para>
|
||||||
<command>CREATE CONTRAINT TRIGGER</command> is a
|
<command>CREATE CONSTRAINT TRIGGER</command> is a
|
||||||
<productname>PostgreSQL</productname> extension of the <acronym>SQL</>
|
<productname>PostgreSQL</productname> extension of the <acronym>SQL</>
|
||||||
standard.
|
standard.
|
||||||
</para>
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
</refentry>
|
<refsect1>
|
||||||
|
<title>See Also</title>
|
||||||
|
|
||||||
|
<simplelist type="inline">
|
||||||
|
<member><xref linkend="sql-createtrigger" endterm="sql-createtrigger-title"></member>
|
||||||
|
<member><xref linkend="sql-droptrigger" endterm="sql-droptrigger-title"></member>
|
||||||
|
<member><xref linkend="sql-set-constraints" endterm="sql-set-constraints-title"></member>
|
||||||
|
</simplelist>
|
||||||
|
</refsect1>
|
||||||
|
</refentry>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.14 2006/09/16 00:30:20 momjian Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.15 2007/02/10 20:43:59 tgl Exp $ -->
|
||||||
<refentry id="SQL-SET-CONSTRAINTS">
|
<refentry id="SQL-SET-CONSTRAINTS">
|
||||||
<refmeta>
|
<refmeta>
|
||||||
<refentrytitle id="SQL-SET-CONSTRAINTS-title">SET CONSTRAINTS</refentrytitle>
|
<refentrytitle id="SQL-SET-CONSTRAINTS-title">SET CONSTRAINTS</refentrytitle>
|
||||||
@ -67,7 +67,8 @@ SET CONSTRAINTS { ALL | <replaceable class="parameter">name</replaceable> [, ...
|
|||||||
<para>
|
<para>
|
||||||
Currently, only foreign key constraints are affected by this
|
Currently, only foreign key constraints are affected by this
|
||||||
setting. Check and unique constraints are always effectively
|
setting. Check and unique constraints are always effectively
|
||||||
not deferrable.
|
not deferrable. Triggers that are declared as <quote>constraint
|
||||||
|
triggers</> are also affected.
|
||||||
</para>
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user