diff --git a/doc/src/sgml/ref/allfiles.sgml b/doc/src/sgml/ref/allfiles.sgml
index f5d67a2078..a352a43141 100644
--- a/doc/src/sgml/ref/allfiles.sgml
+++ b/doc/src/sgml/ref/allfiles.sgml
@@ -46,7 +46,6 @@ Complete list of usable sgml source files in this directory.
-
diff --git a/doc/src/sgml/ref/create_constraint.sgml b/doc/src/sgml/ref/create_constraint.sgml
deleted file mode 100644
index 3ec3f746ee..0000000000
--- a/doc/src/sgml/ref/create_constraint.sgml
+++ /dev/null
@@ -1,171 +0,0 @@
-
-
-
-
- CREATE CONSTRAINT TRIGGER
- 7
- SQL - Language Statements
-
-
-
- CREATE CONSTRAINT TRIGGER
- define a new constraint trigger
-
-
-
- CREATE CONSTRAINT TRIGGER
-
-
-
-
-CREATE CONSTRAINT TRIGGER name
- AFTER event [ OR ... ]
- ON table_name
- [ FROM referenced_table_name ]
- { NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } }
- FOR EACH ROW
- [ WHEN ( condition ) ]
- EXECUTE PROCEDURE function_name ( arguments )
-
-
-
-
- Description
-
-
- CREATE CONSTRAINT TRIGGER creates a
- constraint trigger>. This is the same as a regular trigger
- except that the timing of the trigger firing can be adjusted using
- .
- Constraint triggers must be AFTER ROW> triggers. They can
- be fired either at the end of the statement causing the triggering event,
- or at the end of the containing transaction; in the latter case they are
- said to be deferred>. A pending deferred-trigger firing can
- also be forced to happen immediately by using SET CONSTRAINTS>.
-
-
-
-
- Parameters
-
-
-
- name
-
-
- The name of the constraint trigger. This is also the name to use
- when modifying the trigger's behavior using SET CONSTRAINTS>.
- The name cannot be schema-qualified — the trigger inherits the
- schema of its table.
-
-
-
-
-
- event
-
-
- One of INSERT, UPDATE, or
- DELETE; this specifies the event that will fire the
- trigger. Multiple events can be specified using OR.
-
-
-
-
-
- table_name
-
-
- The (possibly schema-qualified) name of the table in which
- the triggering events occur.
-
-
-
-
-
- referenced_table_name
-
-
- 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.
-
-
-
-
-
- DEFERRABLE
- NOT DEFERRABLE
- INITIALLY IMMEDIATE
- INITIALLY DEFERRED
-
-
- The default timing of the trigger.
- See the
- documentation for details of these constraint options.
-
-
-
-
-
- condition
-
-
- A Boolean expression that determines whether the trigger function
- will actually be executed. This acts the same as in .
- Note in particular that evaluation of the WHEN>
- 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 is not queued for deferred
- execution.
-
-
-
-
-
- function_name
-
-
- The function to call when the trigger is fired. See for
- details.
-
-
-
-
-
- arguments
-
-
- Optional argument strings to pass to the trigger function. See for
- details.
-
-
-
-
-
-
-
- Compatibility
-
- CREATE CONSTRAINT TRIGGER is a
- PostgreSQL extension of the SQL>
- standard.
-
-
-
-
- See Also
-
-
-
-
-
-
-
-
diff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgml
index 95d67aad6f..492611eea8 100644
--- a/doc/src/sgml/ref/create_trigger.sgml
+++ b/doc/src/sgml/ref/create_trigger.sgml
@@ -21,8 +21,10 @@ PostgreSQL documentation
-CREATE TRIGGER name { BEFORE | AFTER | INSTEAD OF } { event [ OR ... ] }
+CREATE [ CONSTRAINT ] TRIGGER name { BEFORE | AFTER | INSTEAD OF } { event [ OR ... ] }
ON table [ FOR [ EACH ] { ROW | STATEMENT } ]
+ [ FROM referenced_table_name ]
+ { NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } }
[ WHEN ( condition ) ]
EXECUTE PROCEDURE function_name ( arguments )
@@ -149,6 +151,20 @@ CREATE TRIGGER name { BEFORE | AFTE
they will be fired in alphabetical order by name.
+
+ When the CONSTRAINT> option is specified, this command creates a
+ constraint trigger>. This is the same as a regular trigger
+ except that the timing of the trigger firing can be adjusted using
+ .
+ Constraint triggers must be AFTER ROW> triggers. They can
+ be fired either at the end of the statement causing the triggering event,
+ or at the end of the containing transaction; in the latter case they are
+ said to be deferred>. A pending deferred-trigger firing can
+ also be forced to happen immediately by using SET CONSTRAINTS>.
+ Constraint triggers are expected to raise an exception when the constraints
+ they implement are violated.
+
+
SELECT does not modify any rows so you cannot
create SELECT triggers. Rules and views are more
@@ -170,6 +186,10 @@ CREATE TRIGGER name { BEFORE | AFTE
The name to give the new trigger. This must be distinct from
the name of any other trigger for the same table.
+ The name cannot be schema-qualified — the trigger inherits the
+ schema of its table. For a constraint trigger, this is also the name to
+ use when modifying the trigger's behavior using
+ SET CONSTRAINTS>.
@@ -181,7 +201,8 @@ CREATE TRIGGER name { BEFORE | AFTE
Determines whether the function is called before, after, or instead of
- the event.
+ the event. A constraint trigger can only be specified as
+ AFTER>.
@@ -222,6 +243,33 @@ UPDATE OF column_name1 [, column_name2
+
+ referenced_table_name
+
+
+ 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.
+
+
+
+
+
+ DEFERRABLE
+ NOT DEFERRABLE
+ INITIALLY IMMEDIATE
+ INITIALLY DEFERRED
+
+
+ The default timing of the trigger.
+ See the documentation for details of
+ these constraint options. This can only be specified for constraint
+ triggers.
+
+
+
+
FOR EACH ROW
FOR EACH STATEMENT
@@ -231,7 +279,8 @@ UPDATE OF column_name1 [, column_name2
This specifies whether the trigger procedure should be fired
once for every row affected by the trigger event, or just once
per SQL statement. If neither is specified, FOR EACH
- STATEMENT is the default.
+ STATEMENT is the default. Constraint triggers can only
+ be specified FOR EACH ROW>.
@@ -263,6 +312,13 @@ UPDATE OF column_name1 [, column_name2
Currently, WHEN expressions cannot contain
subqueries.
+
+
+ Note that for constraint triggers, evaluation of the WHEN>
+ 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 is not queued for deferred execution.
+
@@ -481,6 +537,12 @@ CREATE TRIGGER view_insert
ability to define statement-level triggers on views.
+
+ CREATE CONSTRAINT TRIGGER is a
+ PostgreSQL extension of the SQL>
+ standard.
+
+
@@ -490,6 +552,7 @@ CREATE TRIGGER view_insert
+
diff --git a/doc/src/sgml/reference.sgml b/doc/src/sgml/reference.sgml
index 463746cda3..13de002792 100644
--- a/doc/src/sgml/reference.sgml
+++ b/doc/src/sgml/reference.sgml
@@ -74,7 +74,6 @@
©Table;
&createAggregate;
&createCast;
- &createConstraint;
&createConversion;
&createDatabase;
&createDomain;