Update compatibility information.

This commit is contained in:
Peter Eisentraut 2001-09-13 18:17:44 +00:00
parent 698a5d50c5
commit a6496a2338
2 changed files with 157 additions and 97 deletions

View File

@ -1,9 +1,13 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.16 2001/09/13 15:55:24 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.17 2001/09/13 18:17:44 petere Exp $
Postgres documentation
-->
<refentry id="SQL-CREATETRIGGER">
<docinfo>
<date>2001-09-13</date>
</docinfo>
<refmeta>
<refentrytitle id="SQL-CREATETRIGGER-TITLE">CREATE TRIGGER</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
@ -134,78 +138,55 @@ CREATE
<citetitle>PostgreSQL Programmer's Guide</citetitle> for more
information.
</para>
</refsect1>
<refsect2 id="R2-SQL-CREATETRIGGER-3">
<refsect2info>
<date>1998-09-21</date>
</refsect2info>
<title>
Notes
</title>
<para>
<command>CREATE TRIGGER</command> is a <productname>Postgres</productname>
language extension.
</para>
<para>
Only the relation owner may create a trigger on this relation.
</para>
<para>
As of the current release, STATEMENT triggers are not implemented.
</para>
<para>
Refer to <command>DROP TRIGGER</command> for information on how to
remove triggers.
</para>
</refsect2>
<refsect1 id="SQL-CREATETRIGGER-notes">
<title>Notes</title>
<para>
To create a trigger on a table, the user must have the
<literal>TRIGGER</literal> privilege on the table.
</para>
<para>
As of the current release, <literal>STATEMENT</literal> triggers are not implemented.
</para>
<para>
Refer to the <xref linkend="sql-droptrigger"> command for
information on how to remove triggers.
</para>
</refsect1>
<refsect1 id="R1-SQL-CREATETRIGGER-2">
<title>
Usage
</title>
<title>Examples</title>
<para>
Check if the specified distributor code exists in the distributors
table before appending or updating a row in the table films:
<programlisting>
<programlisting>
CREATE TRIGGER if_dist_exists
BEFORE INSERT OR UPDATE ON films FOR EACH ROW
EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did');
</programlisting>
</programlisting>
</para>
<para>
Before cancelling a distributor or updating its code, remove every
reference to the table films:
<programlisting>
<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>
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-CREATETRIGGER-3">
<title>
Compatibility
</title>
<refsect2 id="R2-SQL-CREATETRIGGER-4">
<refsect2info>
<date>1998-09-21</date>
</refsect2info>
<title>
SQL92
</title>
<para>
The second example can also be done by using a foreign key,
constraint as in:
<para>
There is no <command>CREATE TRIGGER</command> in <acronym>SQL92</acronym>.
</para>
<para>
The second example above may also be done by using a FOREIGN KEY
constraint as in:
<programlisting>
<programlisting>
CREATE TABLE distributors (
did DECIMAL(3),
name VARCHAR(40),
@ -213,9 +194,84 @@ CREATE TABLE distributors (
FOREIGN KEY(did) REFERENCES films
ON UPDATE CASCADE ON DELETE CASCADE
);
</programlisting>
</para>
</refsect2>
</programlisting>
</para>
</refsect1>
<refsect1 id="SQL-CREATETRIGGER-compatibility">
<title>Compatibility</title>
<variablelist>
<varlistentry>
<term>SQL92</term>
<listitem>
<para>
There is no <command>CREATE TRIGGER</command> statement in <acronym>SQL92</acronym>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>SQL99</term>
<listitem>
<para>
The <command>CREATE TRIGGER</command> statement in
<productname>PostgreSQL</productname> implements a subset of the
SQL99 standard. The following functionality is missing:
<itemizedlist>
<listitem>
<para>
SQL99 allows triggers to fire on updates to specific columns
(e.g., <literal>AFTER UPDATE OF col1, col2</literal>).
</para>
</listitem>
<listitem>
<para>
SQL99 allows you to define aliases for the <quote>old</quote>
and <quote>new</quote> rows or tables for use in the definiton
of the triggered action (e.g., <literal>CREATE TRIGGER ... ON
tablename REFERENCING OLD ROW AS somename NEW ROW AS
othername ...</literal>). Since
<productname>PostgreSQL</productname> allows trigger
procedures to be written in any number of user-defined
languages, access to the data is handled in a
language-specific way.
</para>
</listitem>
<listitem>
<para>
<productname>PostgreSQL</productname> only has row-level
triggers, no statement-level triggers.
</para>
</listitem>
<listitem>
<para>
<productname>PostgreSQL</productname> only allows the
execution of a stored procedure for the triggered action.
SQL99 allows the execution of a number of other SQL commands,
such as <command>CREATE TABLE</command> as triggered action.
This limitation is not hard to work around by creating a
stored procedure that executes these commands.
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-createfunction"></member>
<member><xref linkend="sql-droptrigger"></member>
<member><citetitle>PostgreSQL Programmer's Guide</citetitle></member>
</simplelist>
</refsect1>
</refentry>

View File

@ -1,9 +1,13 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_trigger.sgml,v 1.7 2001/09/03 12:57:50 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_trigger.sgml,v 1.8 2001/09/13 18:17:44 petere Exp $
Postgres documentation
-->
<refentry id="SQL-DROPTRIGGER">
<docinfo>
<date>2001-09-13</date>
</docinfo>
<refmeta>
<refentrytitle id="SQL-DROPTRIGGER-TITLE">
DROP TRIGGER
@ -101,58 +105,58 @@ ERROR: DropTrigger: there is no trigger <replaceable class="PARAMETER">name</rep
<para>
<command>DROP TRIGGER</command> will remove all references to an existing
trigger definition. To execute this command the current
user must be the owner of the trigger.
user must be the owner of the table for which the trigger is defined.
</para>
<refsect2 id="R2-SQL-DROPTRIGGER-3">
<refsect2info>
<date>1998-09-22</date>
</refsect2info>
<title>
Notes
</title>
<para>
<command>DROP TRIGGER</command> is a <productname>Postgres</productname>
language extension.
</para>
<para>
Refer to <command>CREATE TRIGGER</command> for
information on how to create triggers.
</para>
</refsect2>
</refsect1>
<refsect1 id="R1-SQL-DROPTRIGGER-2">
<title>
Usage
</title>
<refsect1 id="SQL-DROPTRIGGER-examples">
<title>Examples</title>
<para>
Destroy the <literal>if_dist_exists</literal> trigger
on table <literal>films</literal>:
<programlisting>
<programlisting>
DROP TRIGGER if_dist_exists ON films;
</programlisting>
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-DROPTRIGGER-3">
<title>
Compatibility
</title>
<refsect1 id="SQL-DROPTRIGGER-compatibility">
<title>Compatibility</title>
<refsect2 id="R2-SQL-DROPTRIGGER-4">
<refsect2info>
<date>1998-09-22</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>DROP TRIGGER</command> statement in
<acronym>SQL92</acronym>.
</para>
</refsect2>
<variablelist>
<varlistentry>
<term>SQL92</term>
<listitem>
<para>
There is no <command>DROP TRIGGER</command> statement in
<acronym>SQL92</acronym>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>SQL99</term>
<listitem>
<para>
The <command>DROP TRIGGER</command> statement in
<productname>PostgreSQL</productname> is incompatible with
SQL99. In SQL99, trigger names are not local to tables, so the
command is simply <literal>DROP TRIGGER
<replaceable>name</replaceable></literal>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-createtrigger"></member>
</simplelist>
</refsect1>
</refentry>