From a4ac2f458e8cb76177254f4bd7bbd885991379af Mon Sep 17 00:00:00 2001 From: "Thomas G. Lockhart" Date: Tue, 6 Jul 1999 17:16:42 +0000 Subject: Fix markup for docbook2man man page generation. No big deal; fixed lots of other markup at the same time. Bigest change: make sure there is no whitespace in front of contents. This will probably help the other output types too. --- doc/src/sgml/ref/create_trigger.sgml | 321 +++++++++++++++++------------------ 1 file changed, 159 insertions(+), 162 deletions(-) (limited to 'doc/src/sgml/ref/create_trigger.sgml') diff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgml index c9e241b6f9b..32952a29ce6 100644 --- a/doc/src/sgml/ref/create_trigger.sgml +++ b/doc/src/sgml/ref/create_trigger.sgml @@ -1,120 +1,113 @@ - - - + + + CREATE TRIGGER - - SQL - Language Statements - - - + + SQL - Language Statements + + + CREATE TRIGGER - - + + Creates a new trigger - + - - - 1998-09-21 - - -CREATE TRIGGER name { BEFORE | AFTER } - { event [OR ...] } - ON table FOR EACH { ROW | STATEMENT } - EXECUTE PROCEDURE funcname ( arguments ) - + + + 1998-09-21 + + +CREATE TRIGGER name { BEFORE | AFTER } { event [OR ...] } + ON table FOR EACH { ROW | STATEMENT } + EXECUTE PROCEDURE ER">funcBLE> ( arguments ) + - - - 1998-09-21 - - + <refsect2 id="R2-SQL-CREATETRIGGER-1"> + <refsect2info> + <date>1998-09-21</date> + </refsect2info> + <title> Inputs - - - - - - - name - - - - The name of an existing trigger. - - - - - - table - - - - The name of a table. - - - - - - event - - - - One of INSERT, DELETE or UPDATE. - - - - - - funcname - - - - A user-supplied function. - - - - - - - - - 1998-09-21 - - + + + + + + name + + + The name of an existing trigger. + + + + + table + + + The name of a table. + + + + + event + + + One of INSERT, DELETE or UPDATE. + + + + + funcname + + + A user-supplied function. + + + + + + + + + + 1998-09-21 + + Outputs - - - - - - CREATE - - - - This message is returned if the trigger is successfully created. + + + + + + +CREATE + + + + This message is returned if the trigger is successfully created. - + - - + + - - - 1998-09-21 - - + <refsect1 id="R1-SQL-CREATETRIGGER-1"> + <refsect1info> + <date>1998-09-21</date> + </refsect1info> + <title> Description - - + + CREATE TRIGGER 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 @@ -125,102 +118,106 @@ CREATE TRIGGER name { BEFORE | AFTE 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. - - - - 1998-09-21 - - + </para> + <refsect2 id="R2-SQL-CREATETRIGGER-3"> + <refsect2info> + <date>1998-09-21</date> + </refsect2info> + <title> Notes - - + + CREATE TRIGGER 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. - - + + + 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. - - + + - - + <refsect1 id="R1-SQL-CREATETRIGGER-2"> + <title> Usage - - + + 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'); - - + + +CREATE TRIGGER if_dist_exists + BEFORE INSERT OR UPDATE ON films FOR EACH ROW + EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did'); + + + 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'); - - - - - + <programlisting> +CREATE TRIGGER if_film_exists + BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW + EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did'); + </programlisting> + </para> + </refsect1> + + <refsect1 id="R1-SQL-CREATETRIGGER-3"> + <title> Compatibility - - - + + + - - - 1998-09-21 - - + <refsect2 id="R2-SQL-CREATETRIGGER-4"> + <refsect2info> + <date>1998-09-21</date> + </refsect2info> + <title> SQL92 - - + + 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 ( + + +CREATE TABLE distributors ( did DECIMAL(3), name VARCHAR(40), CONSTRAINT if_film_exists FOREIGN KEY(did) REFERENCES films ON UPDATE CASCADE ON DELETE CASCADE - ); - - +); + + + + However, foreign keys are not yet implemented (as of version 6.4) in Postgres. - + - +