Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita6496a2

Browse files
committed
Update compatibility information.
1 parent698a5d5 commita6496a2

File tree

2 files changed

+157
-97
lines changed

2 files changed

+157
-97
lines changed

‎doc/src/sgml/ref/create_trigger.sgml

Lines changed: 111 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.16 2001/09/1315:55:24 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.17 2001/09/1318:17:44 petere Exp $
33
Postgres documentation
44
-->
55

66
<refentry id="SQL-CREATETRIGGER">
7+
<docinfo>
8+
<date>2001-09-13</date>
9+
</docinfo>
10+
711
<refmeta>
812
<refentrytitle id="SQL-CREATETRIGGER-TITLE">CREATE TRIGGER</refentrytitle>
913
<refmiscinfo>SQL - Language Statements</refmiscinfo>
@@ -134,88 +138,140 @@ CREATE
134138
<citetitle>PostgreSQL Programmer's Guide</citetitle> for more
135139
information.
136140
</para>
141+
</refsect1>
137142

138-
<refsect2 id="R2-SQL-CREATETRIGGER-3">
139-
<refsect2info>
140-
<date>1998-09-21</date>
141-
</refsect2info>
142-
<title>
143-
Notes
144-
</title>
145-
<para>
146-
<command>CREATE TRIGGER</command> is a <productname>Postgres</productname>
147-
language extension.
148-
</para>
149-
<para>
150-
Only the relation owner may create a trigger on this relation.
151-
</para>
152-
<para>
153-
As of the current release, STATEMENT triggers are not implemented.
154-
</para>
155-
<para>
156-
Refer to <command>DROP TRIGGER</command> for information on how to
157-
remove triggers.
158-
</para>
159-
</refsect2>
143+
<refsect1 id="SQL-CREATETRIGGER-notes">
144+
<title>Notes</title>
145+
146+
<para>
147+
To create a trigger on a table, the user must have the
148+
<literal>TRIGGER</literal> privilege on the table.
149+
</para>
150+
151+
<para>
152+
As of the current release, <literal>STATEMENT</literal> triggers are not implemented.
153+
</para>
154+
155+
<para>
156+
Refer to the <xref linkend="sql-droptrigger"> command for
157+
information on how to remove triggers.
158+
</para>
160159
</refsect1>
161160

162161
<refsect1 id="R1-SQL-CREATETRIGGER-2">
163-
<title>
164-
Usage
165-
</title>
162+
<title>Examples</title>
163+
166164
<para>
167165
Check if the specified distributor code exists in the distributors
168166
table before appending or updating a row in the table films:
169167

170-
<programlisting>
168+
<programlisting>
171169
CREATE TRIGGER if_dist_exists
172170
BEFORE INSERT OR UPDATE ON films FOR EACH ROW
173171
EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did');
174-
</programlisting>
172+
</programlisting>
175173
</para>
174+
176175
<para>
177176
Before cancelling a distributor or updating its code, remove every
178177
reference to the table films:
179-
<programlisting>
178+
<programlisting>
180179
CREATE TRIGGER if_film_exists
181180
BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW
182181
EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did');
183-
</programlisting>
182+
</programlisting>
184183
</para>
185-
</refsect1>
186-
187-
<refsect1 id="R1-SQL-CREATETRIGGER-3">
188-
<title>
189-
Compatibility
190-
</title>
191-
192-
<refsect2 id="R2-SQL-CREATETRIGGER-4">
193-
<refsect2info>
194-
<date>1998-09-21</date>
195-
</refsect2info>
196-
<title>
197-
SQL92
198-
</title>
199184

200-
<para>
201-
There is no <command>CREATE TRIGGER</command> in <acronym>SQL92</acronym>.
202-
</para>
203-
204-
<para>
205-
The second example above may also be done by using a FOREIGN KEY
206-
constraint as in:
185+
<para>
186+
The second example can also be done by using a foreign key,
187+
constraint as in:
207188

208-
<programlisting>
189+
<programlisting>
209190
CREATE TABLE distributors (
210191
did DECIMAL(3),
211192
name VARCHAR(40),
212193
CONSTRAINT if_film_exists
213194
FOREIGN KEY(did) REFERENCES films
214195
ON UPDATE CASCADE ON DELETE CASCADE
215196
);
216-
</programlisting>
217-
</para>
218-
</refsect2>
197+
</programlisting>
198+
</para>
199+
</refsect1>
200+
201+
<refsect1 id="SQL-CREATETRIGGER-compatibility">
202+
<title>Compatibility</title>
203+
204+
<variablelist>
205+
<varlistentry>
206+
<term>SQL92</term>
207+
<listitem>
208+
<para>
209+
There is no <command>CREATE TRIGGER</command> statement in <acronym>SQL92</acronym>.
210+
</para>
211+
</listitem>
212+
</varlistentry>
213+
214+
<varlistentry>
215+
<term>SQL99</term>
216+
<listitem>
217+
<para>
218+
The <command>CREATE TRIGGER</command> statement in
219+
<productname>PostgreSQL</productname> implements a subset of the
220+
SQL99 standard. The following functionality is missing:
221+
<itemizedlist>
222+
<listitem>
223+
<para>
224+
SQL99 allows triggers to fire on updates to specific columns
225+
(e.g., <literal>AFTER UPDATE OF col1, col2</literal>).
226+
</para>
227+
</listitem>
228+
229+
<listitem>
230+
<para>
231+
SQL99 allows you to define aliases for the <quote>old</quote>
232+
and <quote>new</quote> rows or tables for use in the definiton
233+
of the triggered action (e.g., <literal>CREATE TRIGGER ... ON
234+
tablename REFERENCING OLD ROW AS somename NEW ROW AS
235+
othername ...</literal>). Since
236+
<productname>PostgreSQL</productname> allows trigger
237+
procedures to be written in any number of user-defined
238+
languages, access to the data is handled in a
239+
language-specific way.
240+
</para>
241+
</listitem>
242+
243+
<listitem>
244+
<para>
245+
<productname>PostgreSQL</productname> only has row-level
246+
triggers, no statement-level triggers.
247+
</para>
248+
</listitem>
249+
250+
<listitem>
251+
<para>
252+
<productname>PostgreSQL</productname> only allows the
253+
execution of a stored procedure for the triggered action.
254+
SQL99 allows the execution of a number of other SQL commands,
255+
such as <command>CREATE TABLE</command> as triggered action.
256+
This limitation is not hard to work around by creating a
257+
stored procedure that executes these commands.
258+
</para>
259+
</listitem>
260+
</itemizedlist>
261+
</para>
262+
</listitem>
263+
</varlistentry>
264+
</variablelist>
265+
</refsect1>
266+
267+
<refsect1>
268+
<title>See Also</title>
269+
270+
<simplelist type="inline">
271+
<member><xref linkend="sql-createfunction"></member>
272+
<member><xref linkend="sql-droptrigger"></member>
273+
<member><citetitle>PostgreSQL Programmer's Guide</citetitle></member>
274+
</simplelist>
219275
</refsect1>
220276
</refentry>
221277

‎doc/src/sgml/ref/drop_trigger.sgml

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_trigger.sgml,v 1.7 2001/09/03 12:57:50 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_trigger.sgml,v 1.8 2001/09/13 18:17:44 petere Exp $
33
Postgres documentation
44
-->
55

66
<refentry id="SQL-DROPTRIGGER">
7+
<docinfo>
8+
<date>2001-09-13</date>
9+
</docinfo>
10+
711
<refmeta>
812
<refentrytitle id="SQL-DROPTRIGGER-TITLE">
913
DROP TRIGGER
@@ -101,58 +105,58 @@ ERROR: DropTrigger: there is no trigger <replaceable class="PARAMETER">name</rep
101105
<para>
102106
<command>DROP TRIGGER</command> will remove all references to an existing
103107
trigger definition. To execute this command the current
104-
user must be the owner of the trigger.
108+
user must be the owner of thetable for which thetrigger is defined.
105109
</para>
106-
107-
<refsect2 id="R2-SQL-DROPTRIGGER-3">
108-
<refsect2info>
109-
<date>1998-09-22</date>
110-
</refsect2info>
111-
<title>
112-
Notes
113-
</title>
114-
<para>
115-
<command>DROP TRIGGER</command> is a <productname>Postgres</productname>
116-
language extension.
117-
</para>
118-
<para>
119-
Refer to <command>CREATE TRIGGER</command> for
120-
information on how to create triggers.
121-
</para>
122-
</refsect2>
123110
</refsect1>
124-
125-
<refsect1 id="R1-SQL-DROPTRIGGER-2">
126-
<title>
127-
Usage
128-
</title>
111+
112+
<refsect1 id="SQL-DROPTRIGGER-examples">
113+
<title>Examples</title>
114+
129115
<para>
130116
Destroy the <literal>if_dist_exists</literal> trigger
131117
on table <literal>films</literal>:
132118

133-
<programlisting>
119+
<programlisting>
134120
DROP TRIGGER if_dist_exists ON films;
135-
</programlisting>
121+
</programlisting>
136122
</para>
137123
</refsect1>
138124

139-
<refsect1 id="R1-SQL-DROPTRIGGER-3">
140-
<title>
141-
Compatibility
142-
</title>
125+
<refsect1 id="SQL-DROPTRIGGER-compatibility">
126+
<title>Compatibility</title>
143127

144-
<refsect2 id="R2-SQL-DROPTRIGGER-4">
145-
<refsect2info>
146-
<date>1998-09-22</date>
147-
</refsect2info>
148-
<title>
149-
SQL92
150-
</title>
151-
<para>
152-
There is no <command>DROP TRIGGER</command> statement in
153-
<acronym>SQL92</acronym>.
154-
</para>
155-
</refsect2>
128+
<variablelist>
129+
<varlistentry>
130+
<term>SQL92</term>
131+
<listitem>
132+
<para>
133+
There is no <command>DROP TRIGGER</command> statement in
134+
<acronym>SQL92</acronym>.
135+
</para>
136+
</listitem>
137+
</varlistentry>
138+
139+
<varlistentry>
140+
<term>SQL99</term>
141+
<listitem>
142+
<para>
143+
The <command>DROP TRIGGER</command> statement in
144+
<productname>PostgreSQL</productname> is incompatible with
145+
SQL99. In SQL99, trigger names are not local to tables, so the
146+
command is simply <literal>DROP TRIGGER
147+
<replaceable>name</replaceable></literal>.
148+
</para>
149+
</listitem>
150+
</varlistentry>
151+
</variablelist>
152+
</refsect1>
153+
154+
<refsect1>
155+
<title>See Also</title>
156+
157+
<simplelist type="inline">
158+
<member><xref linkend="sql-createtrigger"></member>
159+
</simplelist>
156160
</refsect1>
157161
</refentry>
158162

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp