Improve documentation for CREATE CONSTRAINT TRIGGER.
authorTom Lane
Sat, 10 Feb 2007 20:43:59 +0000 (20:43 +0000)
committerTom Lane
Sat, 10 Feb 2007 20:43:59 +0000 (20:43 +0000)
doc/src/sgml/ref/create_constraint.sgml
doc/src/sgml/ref/set_constraints.sgml

index 9600647bf672fae9168620c30c8af92b44672263..e46a1fb03e0085d9db9c88b42224b39f8b404048 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -15,13 +15,13 @@ PostgreSQL documentation
  
 
  
-  CREATE CONSTRAINT
+  CREATE CONSTRAINT TRIGGER
  
 
  
 
 CREATE CONSTRAINT TRIGGER name
-    AFTER event [ OR ... ]
+    AFTER event [ OR ... ]
     ON table_name
     [ FROM referenced_table_name ]
     { NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } }
@@ -34,15 +34,19 @@ CREATE CONSTRAINT TRIGGER name
   Description
 
   
-   CREATE CONSTRAINT TRIGGER is used within
-   CREATE TABLE/ALTER TABLE and by
-   pg_dump to create the special triggers for
-   referential integrity.
-    It is not intended for general use.
-   
-  
+   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
 
   
@@ -50,11 +54,10 @@ CREATE CONSTRAINT TRIGGER name
     name
     
      
-      The name of the constraint trigger. The actual name of the
-      created trigger will be of the form
-      RI_ConstraintTrigger_0000 (where 0000 is some number
-      assigned by the server).
-      Use this assigned name when dropping the trigger.
+      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.
      
     
    
@@ -84,8 +87,9 @@ CREATE CONSTRAINT TRIGGER name
     referenced_table_name
     
      
-      The (possibly schema-qualified) name of the table referenced by the
-      constraint. Used by foreign key constraints triggers.
+      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.
      
     
    
@@ -97,6 +101,7 @@ CREATE CONSTRAINT TRIGGER name
     INITIALLY DEFERRED
     
      
+      The default timing of the trigger.
       See the 
       documentation for details of these constraint options.
      
@@ -104,10 +109,21 @@ CREATE CONSTRAINT TRIGGER name
    
 
    
-    funcname(args)
+    funcname
     
      
-      The function to call as part of the trigger processing. See 
+      The function to call when the trigger is fired. See 
+      linkend="SQL-CREATETRIGGER" endterm="SQL-CREATETRIGGER-TITLE"> for
+      details.
+     
+    
+   
+
+   
+    arguments
+    
+     
+      Optional argument strings to pass to the trigger function. See 
       linkend="SQL-CREATETRIGGER" endterm="SQL-CREATETRIGGER-TITLE"> for
       details.
      
@@ -119,11 +135,19 @@ CREATE CONSTRAINT TRIGGER name
  
   Compatibility
   
-   CREATE CONTRAINT TRIGGER is a
+   CREATE CONSTRAINT TRIGGER is a
    PostgreSQL extension of the SQL
    standard.
   
  
 
+  See Also
 
+  
+   
+   
+   
+  
+
index e569cf198eb56c69071af3e6a678515609d64627..553080770b39ef10be810bee06f640adaaaf36cc 100644 (file)
@@ -1,4 +1,4 @@
-
+
 
  
   SET CONSTRAINTS
@@ -67,7 +67,8 @@ SET CONSTRAINTS { ALL | name [, ...
   
    Currently, only foreign key constraints are affected by this
    setting. Check and unique constraints are always effectively
-   not deferrable.
+   not deferrable. Triggers that are declared as constraint
+   triggers are also affected.