1CREATE CONSTRAINT TRIGGER(7)     SQL Commands     CREATE CONSTRAINT TRIGGER(7)
2
3
4

NAME

6       CREATE CONSTRAINT TRIGGER - define a new constraint trigger
7
8

SYNOPSIS

10       CREATE CONSTRAINT TRIGGER name
11           AFTER event [ OR ... ]
12           ON table_name
13           [ FROM referenced_table_name ]
14           { NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } }
15           FOR EACH ROW
16           EXECUTE PROCEDURE funcname ( arguments )
17
18

DESCRIPTION

20       CREATE  CONSTRAINT  TRIGGER  creates  a constraint trigger. This is the
21       same as a regular trigger except that the timing of the trigger  firing
22       can be adjusted using SET CONSTRAINTS [set_constraints(7)].  Constraint
23       triggers must be AFTER ROW triggers. They can be fired  either  at  the
24       end of the statement causing the triggering event, or at the end of the
25       containing transaction;  in  the  latter  case  they  are  said  to  be
26       deferred.  A pending deferred-trigger firing can also be forced to hap‐
27       pen immediately by using SET CONSTRAINTS.
28

PARAMETERS

30       name   The name of the constraint trigger. This is also the name to use
31              when  modifying  the  trigger's  behavior using SET CONSTRAINTS.
32              The name cannot be schema-qualified — the trigger  inherits  the
33              schema of its table.
34
35       event  One  of INSERT, UPDATE, or DELETE; this specifies the event that
36              will fire the trigger. Multiple events can  be  specified  using
37              OR.
38
39       table_name
40              The  (possibly  schema-qualified) name of the table in which the
41              triggering events occur.
42
43       referenced_table_name
44              The (possibly schema-qualified) name of another table referenced
45              by  the  constraint.  This  option  is used for foreign-key con‐
46              straints and is not recommended for general use.
47
48       DEFERRABLE
49
50       NOT DEFERRABLE
51
52       INITIALLY IMMEDIATE
53
54       INITIALLY DEFERRED
55              The default timing of the trigger.  See the CREATE  TABLE  [cre‐
56              ate_table(7)]  documentation  for  details  of  these constraint
57              options.
58
59       funcname
60              The function to call when the trigger is fired. See CREATE TRIG‐
61              GER [create_trigger(7)] for details.
62
63       arguments
64              Optional  argument  strings to pass to the trigger function. See
65              CREATE TRIGGER [create_trigger(7)] for details.
66

COMPATIBILITY

68       CREATE CONSTRAINT TRIGGER is a PostgreSQL extension of  the  SQL  stan‐
69       dard.
70

SEE ALSO

72       CREATE TRIGGER [create_trigger(7)], DROP TRIGGER [drop_trigger(7)], SET
73       CONSTRAINTS [set_constraints(7)]
74
75
76
77SQL - Language Statements         2014-02-17      CREATE CONSTRAINT TRIGGER(7)
Impressum