head	1.5;
access;
symbols
	REL7_2_8:1.4
	REL7_2_7:1.4
	REL7_2_6:1.4
	REL7_2_5:1.4
	REL7_2_4:1.4
	REL7_2_3:1.4
	REL7_2_STABLE:1.4.0.6
	REL7_2:1.4
	REL7_2_RC2:1.4
	REL7_2_RC1:1.4
	REL7_2_BETA5:1.4
	REL7_2_BETA4:1.4
	REL7_2_BETA3:1.4
	REL7_2_BETA2:1.4
	REL7_2_BETA1:1.4
	REL7_1_2:1.4
	REL7_1_STABLE:1.4.0.4
	REL7_1_BETA:1.4
	REL7_1_BETA3:1.4
	REL7_1_BETA2:1.4
	REL7_1:1.4
	REL7_0_PATCHES:1.4.0.2
	REL7_0:1.4
	REL6_5_PATCHES:1.1.0.2;
locks; strict;
comment	@# @;


1.5
date	2002.08.30.16.48.43;	author momjian;	state dead;
branches;
next	1.4;

1.4
date	99.10.30.16.18.50;	author momjian;	state Exp;
branches;
next	1.3;

1.3
date	99.10.30.16.01.13;	author momjian;	state dead;
branches;
next	1.2;

1.2
date	99.09.20.22.30.47;	author scrappy;	state Exp;
branches;
next	1.1;

1.1
date	99.09.13.18.47.30;	author momjian;	state dead;
branches
	1.1.2.1;
next	;

1.1.2.1
date	99.09.13.18.47.30;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.5
log
@Remove pgaccess from CVS.  It has its own home now.
@
text
@.pgaw:Help.f.t insert end "CREATE TRIGGER" {bold} " will enter a new trigger into the current data base. The trigger will be associated with the relation relname and will execute the specified function funcname. 

The trigger can be specified to fire either before the operation is attempted on a tuple (before constraints are checked and the INSERT, UPDATE or DELETE is attempted) or after the operation \
has been attempted (e.g. after constraints are checked and the INSERT, UPDATE or DELETE has completed). If the trigger fires before the event, the trigger may skip the operation for the \
current tuple, or change the tuple being inserted (for INSERT and UPDATE operations only). If the trigger fires after the event, all changes, including the last insertion, update, or deletion, are \
\"visible\" to the trigger. 

Refer to the chapters on SPI and Triggers in the PostgreSQL Programmer's Guide for more information. 

" {} "Synopsis" {bold} "

CREATE TRIGGER name \{ BEFORE | AFTER \}
    \{ event \[OR ...\] \}
    ON table FOR EACH \{ ROW | STATEMENT \}
    EXECUTE PROCEDURE funcname ( arguments )

" {code} "Inputs" {bold} "

" {} "name" {italic} "
       The name of an existing trigger. 

" {} "table" {italic} "
       The name of a table. 

" {} "event" {italic} "
       One of INSERT, DELETE or UPDATE. 

" {} "funcname" {italic} "
       A user-supplied function. 

" {} "Outputs" {bold} "

" {} "CREATE" {italic} "
       This message is returned if the trigger is successfully created. 

" {} "Usage" {bold} "

Check if the specified distributor code exists in the distributors table before appending or updating a row in the table films: 
" {} "
   CREATE TRIGGER if_dist_exists
   BEFORE INSERT OR UPDATE ON films FOR EACH ROW
   EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did');
  
" {code} "
Before cancelling a distributor or updating its code, remove every reference to the table films: 
" {} "
   CREATE TRIGGER if_film_exists 
   BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW
   EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did');



" {code} "Compatibility" {bold} "

" {} "SQL92" {italic} "

There is no CREATE TRIGGER in SQL92. 

The second example above may also be done by using a FOREIGN KEY constraint as in: 
" {} "
    CREATE TABLE distributors (
    did      DECIMAL(3),
    name     VARCHAR(40),
    CONSTRAINT if_film_exists
    FOREIGN KEY(did) REFERENCES films
    ON UPDATE CASCADE ON DELETE CASCADE  
    );
   
" {code} "
However, foreign keys are not yet implemented (as of version 6.4) in Postgres. 

" {} "Notes" {bold} "

" {} "CREATE TRIGGER" {italic} " is a Postgres language extension. 

Only the relation owner may create a trigger on this relation. 

As of the current release (v6.4), STATEMENT triggers are not implemented. 

Refer to DROP TRIGGER for information on how to remove triggers. "
@


1.4
log
@Add 0.98.
@
text
@@


1.3
log
@Remove 0.96 for update to 0.98
@
text
@@


1.2
log
@
bring it all into -current again
@
text
@@


1.1
log
@file create_trigger.hlp was initially added on branch REL6_5_PATCHES.
@
text
@d1 80
@


1.1.2.1
log
@Update pgaccess 0.98
@
text
@a0 80
.pgaw:Help.f.t insert end "CREATE TRIGGER" {bold} " will enter a new trigger into the current data base. The trigger will be associated with the relation relname and will execute the specified function funcname. 

The trigger can be specified to fire either before the operation is attempted on a tuple (before constraints are checked and the INSERT, UPDATE or DELETE is attempted) or after the operation \
has been attempted (e.g. after constraints are checked and the INSERT, UPDATE or DELETE has completed). If the trigger fires before the event, the trigger may skip the operation for the \
current tuple, or change the tuple being inserted (for INSERT and UPDATE operations only). If the trigger fires after the event, all changes, including the last insertion, update, or deletion, are \
\"visible\" to the trigger. 

Refer to the chapters on SPI and Triggers in the PostgreSQL Programmer's Guide for more information. 

" {} "Synopsis" {bold} "

CREATE TRIGGER name \{ BEFORE | AFTER \}
    \{ event \[OR ...\] \}
    ON table FOR EACH \{ ROW | STATEMENT \}
    EXECUTE PROCEDURE funcname ( arguments )

" {code} "Inputs" {bold} "

" {} "name" {italic} "
       The name of an existing trigger. 

" {} "table" {italic} "
       The name of a table. 

" {} "event" {italic} "
       One of INSERT, DELETE or UPDATE. 

" {} "funcname" {italic} "
       A user-supplied function. 

" {} "Outputs" {bold} "

" {} "CREATE" {italic} "
       This message is returned if the trigger is successfully created. 

" {} "Usage" {bold} "

Check if the specified distributor code exists in the distributors table before appending or updating a row in the table films: 
" {} "
   CREATE TRIGGER if_dist_exists
   BEFORE INSERT OR UPDATE ON films FOR EACH ROW
   EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did');
  
" {code} "
Before cancelling a distributor or updating its code, remove every reference to the table films: 
" {} "
   CREATE TRIGGER if_film_exists 
   BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW
   EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did');



" {code} "Compatibility" {bold} "

" {} "SQL92" {italic} "

There is no CREATE TRIGGER in SQL92. 

The second example above may also be done by using a FOREIGN KEY constraint as in: 
" {} "
    CREATE TABLE distributors (
    did      DECIMAL(3),
    name     VARCHAR(40),
    CONSTRAINT if_film_exists
    FOREIGN KEY(did) REFERENCES films
    ON UPDATE CASCADE ON DELETE CASCADE  
    );
   
" {code} "
However, foreign keys are not yet implemented (as of version 6.4) in Postgres. 

" {} "Notes" {bold} "

" {} "CREATE TRIGGER" {italic} " is a Postgres language extension. 

Only the relation owner may create a trigger on this relation. 

As of the current release (v6.4), STATEMENT triggers are not implemented. 

Refer to DROP TRIGGER for information on how to remove triggers. "
@
