(optionally schema-qualified) of the table, view, or foreign
table the trigger is for.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">referenced_table_name</replaceable></term>
<listitem>
<para>
The (possibly schema-qualified) name of another table referenced by the
constraint. This option is used for foreign-key constraints and is not
recommended for general use. This can only be specified for
constraint triggers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>DEFERRABLE</literal></term>
<term><literal>NOT DEFERRABLE</literal></term>
<term><literal>INITIALLY IMMEDIATE</literal></term>
<term><literal>INITIALLY DEFERRED</literal></term>
<listitem>
<para>
The default timing of the trigger.
See the <xref linkend="sql-createtable"/> documentation for details of
these constraint options. This can only be specified for constraint
triggers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>REFERENCING</literal></term>
<listitem>
<para>
This keyword immediately precedes the declaration of one or two
relation names that provide access to the transition relations of the
triggering statement.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>OLD TABLE</literal></term>
<term><literal>NEW TABLE</literal></term>
<listitem>
<para>
This clause indicates whether the following relation name is for the
before-image transition relation or the after-image transition
relation.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">transition_relation_name</replaceable></term>
<listitem>
<para>
The (unqualified) name to be used within the trigger for this
transition relation.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>FOR EACH ROW</literal></term>
<term><literal>FOR EACH STATEMENT</literal></term>
<listitem>
<para>
This specifies whether the trigger function should be fired
once for every row affected by the trigger event, or just once
per SQL statement. If neither is specified, <literal>FOR EACH
STATEMENT</literal> is the default. Constraint triggers can only
be specified <literal>FOR EACH ROW</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">condition</replaceable></term>
<listitem>
<para>
A Boolean expression that determines whether the trigger function
will actually be executed. If <literal>WHEN</literal> is specified, the
function will only be called if the <replaceable
class="parameter">condition</replaceable> returns <literal>true</literal>.
In <literal>FOR EACH ROW</literal> triggers, the <literal>WHEN</literal>
condition can refer to columns of the old and/or new row values
by writing <literal>OLD.<replaceable
class="parameter">column_name</replaceable></literal> or
<literal>NEW.<replaceable
class="parameter">column_name</replaceable></literal> respectively.
Of course, <literal>INSERT</literal> triggers cannot refer to <literal>OLD</literal>
and <literal>DELETE</literal> triggers cannot refer to <literal>NEW</literal>.
</para>
<para><literal>INSTEAD OF</literal> triggers do not support <literal>WHEN</literal>
conditions.
</para>
<para>
Currently, <literal>WHEN</literal> expressions cannot contain
subqueries.
</para>
<para>
Note that for constraint triggers, evaluation of the <literal>WHEN</literal>
condition is not deferred, but occurs immediately after the row update
operation is performed. If the condition does not evaluate to true then
the trigger