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

Commit64fbd1f

Browse files
author
Thomas G. Lockhart
committed
Add new files from Oliver Elphick.
1 parenta9d76d0 commit64fbd1f

File tree

3 files changed

+789
-38
lines changed

3 files changed

+789
-38
lines changed

‎doc/src/sgml/ref/commands.sgml

Lines changed: 104 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,109 @@
1-
<Chapter>
2-
<Title>Commands</Title>
1+
<!-- allfiles.sgml
2+
-
3+
- Complete list of usable sgml source files in this directory.
4+
-
5+
- -->
36

4-
<Para>
5-
</Para>
7+
<!entity intro-ref system "intro-ref.sgml">
8+
<!entity commands system "commands.sgml">
69

7-
&alterTable;
8-
&alterUser;
9-
&begin;
10-
&close;
11-
&cluster;
12-
&commit;
13-
&copy;
14-
&createAggregate;
15-
&createDatabase;
16-
&createFunction;
17-
&createIndex;
18-
&createLanguage;
19-
&createOperator;
20-
&createRule;
21-
&createSequence;
22-
&createTable;
23-
&dropFunction;
24-
&select;
10+
<!-- these will go into the "operators" reference chapter -->
11+
<!entity all system "all.sgml">
12+
<!entity any system "any.sgml">
13+
<!entity between system "between.sgml">
14+
<!entity in system "in.sgml">
15+
<!entity like system "like.sgml">
2516

26-
</Chapter>
17+
<!-- these will go into the "functions" reference chapter -->
18+
<!entity avg system "avg.sgml">
19+
<!entity cast system "cast.sgml">
20+
<!entity charLength system "char_length.sgml">
21+
<!entity count system "count.sgml">
22+
<!entity currentDate system "current_date.sgml">
23+
<!entity currentTime system "current_time.sgml">
24+
<!entity currentTimestamp system "current_timestamp.sgml">
25+
<!entity currentUser system "current_user.sgml">
26+
<!entity exists system "exists.sgml">
27+
<!entity extract system "extract.sgml">
28+
<!entity initcap system "initcap.sgml">
29+
<!entity lower system "lower.sgml">
30+
<!entity lpad system "lpad.sgml">
31+
<!entity max system "max.sgml">
32+
<!entity min system "min.sgml">
33+
<!entity position system "position.sgml">
34+
<!entity rpad system "rpad.sgml">
35+
<!entity substring system "substring.sgml">
36+
<!entity sum system "sum.sgml">
37+
<!entity translate system "translate.sgml">
38+
<!entity trim system "trim.sgml">
39+
<!entity upper system "upper.sgml">
2740

28-
<!-- Keep this comment at the end of the file
29-
Local variables:
30-
mode: sgml
31-
sgml-omittag:t
32-
sgml-shorttag:t
33-
sgml-minimize-attributes:nil
34-
sgml-always-quote-attributes:t
35-
sgml-indent-step:1
36-
sgml-indent-data:t
37-
sgml-parent-document:nil
38-
sgml-default-dtd-file:"../reference.ced"
39-
sgml-exposed-tags:nil
40-
sgml-local-catalogs:"/usr/lib/sgml/catalog"
41-
sgml-local-ecat-files:nil
42-
End:
41+
<!-- these are folded into create_table.sgml
42+
<!entity check system "check.sgml">
43+
<!entity constraints system "constraint.sgml">
44+
<!entity default system "default.sgml">
45+
<!entity notNull system "not_null.sgml">
46+
<!entity primaryKey system "primary_key.sgml">
47+
<!entity unique system "unique.sgml">
4348
-->
49+
50+
<!-- these are folded into select.sgml
51+
<!entity groupBy system "group_by.sgml">
52+
<!entity having system "having.sgml">
53+
<!entity orderBy system "order_by.sgml">
54+
<!entity union system "union.sgml">
55+
-->
56+
57+
<!-- these are in the "commands" reference chapter -->
58+
<!entity alterTable system "alter_table.sgml">
59+
<!entity alterUser system "alter_user.sgml">
60+
<!entity begin system "begin.sgml">
61+
<!entity close system "close.sgml">
62+
<!entity cluster system "cluster.sgml">
63+
<!entity commit system "commit.sgml">
64+
<!entity copy system "copy.sgml">
65+
<!entity createAggregate system "create_aggregate.sgml">
66+
<!entity createDatabase system "create_database.sgml">
67+
<!entity createFunction system "create_function.sgml">
68+
<!entity createIndex system "create_index.sgml">
69+
<!entity createLanguage system "create_language.sgml">
70+
<!entity createOperator system "create_operator.sgml">
71+
<!entity createRule system "create_rule.sgml">
72+
<!entity createSequence system "create_sequence.sgml">
73+
<!entity createTable system "create_table.sgml">
74+
<!entity createTrigger system "create_trigger.sgml">
75+
<!entity createType system "create_type.sgml">
76+
<!entity createUser system "create_user.sgml">
77+
<!entity createView system "create_view.sgml">
78+
<!entity declare system "declare.sgml">
79+
<!entity delete system "delete.sgml">
80+
<!entity dropAggregate system "drop_aggregate.sgml">
81+
<!entity dropDatabase system "drop_database.sgml">
82+
<!entity dropFunction system "drop_function.sgml">
83+
<!entity dropIndex system "drop_index.sgml">
84+
<!entity dropLanguage system "drop_language.sgml">
85+
<!entity dropOperator system "drop_operator.sgml">
86+
<!entity dropRule system "drop_rule.sgml">
87+
<!entity dropSequence system "drop_sequence.sgml">
88+
<!entity dropTable system "drop_table.sgml">
89+
<!entity dropTrigger system "drop_trigger.sgml">
90+
<!entity dropType system "drop_type.sgml">
91+
<!entity dropUser system "drop_user.sgml">
92+
<!entity dropView system "drop_view.sgml">
93+
<!entity explain system "explain.sgml">
94+
<!entity fetch system "fetch.sgml">
95+
<!entity grant system "grant.sgml">
96+
<!entity insert system "insert.sgml">
97+
<!entity listen system "listen.sgml">
98+
<!entity load system "load.sgml">
99+
<!entity lock system "lock.sgml">
100+
<!entity move system "move.sgml">
101+
<!entity notify system "notify.sgml">
102+
<!entity reset system "reset.sgml">
103+
<!entity revoke system "revoke.sgml">
104+
<!entity rollback system "rollback.sgml">
105+
<!entity select system "select.sgml">
106+
<!entity set system "set.sgml">
107+
<!entity show system "show.sgml">
108+
<!entity update system "update.sgml">
109+
<!entity vacuum system "vacuum.sgml">

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

Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
<REFENTRY ID="SQL-CREATETRIGGER-1">
2+
<REFMETA>
3+
<REFENTRYTITLE>
4+
CREATE TRIGGER
5+
</REFENTRYTITLE>
6+
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
7+
</REFMETA>
8+
<REFNAMEDIV>
9+
<REFNAME>
10+
CREATE TRIGGER
11+
</REFNAME>
12+
<REFPURPOSE>
13+
CREATE TRIGGER - creates a new trigger.
14+
</REFPURPOSE>
15+
<REFSYNOPSISDIV>
16+
<REFSYNOPSISDIVINFO>
17+
<DATE>1998-04-15</DATE>
18+
</REFSYNOPSISDIVINFO>
19+
<SYNOPSIS>
20+
CREATE TRIGGER <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> { BEFORE | AFTER }
21+
{ <REPLACEABLE CLASS="PARAMETER">event</REPLACEABLE> [OR ...] }
22+
ON <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> FOR EACH { ROW | STATEMENT }
23+
EXECUTE PROCEDURE <REPLACEABLE CLASS="PARAMETER">funcname</REPLACEABLE> ( <REPLACEABLE CLASS="PARAMETER">arguments</REPLACEABLE> )
24+
</SYNOPSIS>
25+
26+
<REFSECT2 ID="R2-SQL-CREATETRIGGER-1">
27+
<REFSECT2INFO>
28+
<DATE>1998-04-15</DATE>
29+
</REFSECT2INFO>
30+
<TITLE>
31+
Inputs
32+
</TITLE>
33+
<PARA>
34+
</PARA>
35+
<VARIABLELIST>
36+
<VARLISTENTRY>
37+
<TERM>
38+
</TERM>
39+
<LISTITEM>
40+
<PARA>
41+
<VARIABLELIST>
42+
<VARLISTENTRY>
43+
<TERM>
44+
<ReturnValue><replaceable class="parameter">name</replaceable></ReturnValue>
45+
</TERM>
46+
<LISTITEM>
47+
<PARA>
48+
The name of an existing trigger.
49+
</PARA>
50+
</LISTITEM>
51+
</VARLISTENTRY>
52+
<VARLISTENTRY>
53+
<TERM>
54+
<ReturnValue><replaceable class="parameter">table</replaceable></ReturnValue>
55+
</TERM>
56+
<LISTITEM>
57+
<PARA>
58+
The name of a table.
59+
</PARA>
60+
</LISTITEM>
61+
</VARLISTENTRY>
62+
<VARLISTENTRY>
63+
<TERM>
64+
<ReturnValue><replaceable class="parameter">event</replaceable></ReturnValue>
65+
</TERM>
66+
<LISTITEM>
67+
<PARA>
68+
One of INSERT, DELETE or UPDATE.
69+
</PARA>
70+
</LISTITEM>
71+
</VARLISTENTRY>
72+
<VARLISTENTRY>
73+
<TERM>
74+
<ReturnValue><replaceable class="parameter">funcname</replaceable></ReturnValue>
75+
</TERM>
76+
<LISTITEM>
77+
<PARA>
78+
A user-supplied function.
79+
</PARA>
80+
</LISTITEM>
81+
</VARLISTENTRY>
82+
</variablelist>
83+
</LISTITEM>
84+
</VARLISTENTRY>
85+
</VARIABLELIST>
86+
</REFSECT2>
87+
88+
<REFSECT2 ID="R2-SQL-CREATETRIGGER-2">
89+
<REFSECT2INFO>
90+
<DATE>1998-04-15</DATE>
91+
</REFSECT2INFO>
92+
<TITLE>
93+
Outputs
94+
</TITLE>
95+
<PARA>
96+
</PARA>
97+
<VARIABLELIST>
98+
<VARLISTENTRY>
99+
<TERM>
100+
</TERM>
101+
<LISTITEM>
102+
<PARA>
103+
<VARIABLELIST>
104+
<VARLISTENTRY>
105+
<TERM>
106+
<ReturnValue>CREATE</ReturnValue>
107+
</TERM>
108+
<LISTITEM>
109+
<PARA>
110+
This message is returned if the trigger is successfully created.
111+
</PARA>
112+
</LISTITEM>
113+
</VARLISTENTRY>
114+
</variablelist>
115+
</LISTITEM>
116+
</VARLISTENTRY>
117+
</VARIABLELIST>
118+
</REFSECT2>
119+
</REFSYNOPSISDIV>
120+
121+
<REFSECT1 ID="R1-SQL-CREATETRIGGER-1">
122+
<REFSECT1INFO>
123+
<DATE>1998-04-15</DATE>
124+
</REFSECT1INFO>
125+
<TITLE>
126+
Description
127+
</TITLE>
128+
<PARA>
129+
CREATE TRIGGER will enter a new trigger into the current
130+
data base. The trigger will be associated with the relation
131+
<replaceable class="parameter">relname</replaceable> and will execute
132+
the specified function <replaceable class="parameter">funcname</replaceable>.
133+
</PARA>
134+
<PARA>
135+
Only the relation owner may create a trigger on this relation.
136+
</PARA>
137+
<PARA>
138+
At release 6.3.2, STATEMENT triggers are not implemented.
139+
</PARA>
140+
<PARA>
141+
The trigger can be specified to fire either before the
142+
operation is attempted on a tuple (before constraints
143+
are checked and the INSERT, UPDATE or DELETE is attempted) or
144+
after the operation has been attempted (e.g. after constraints
145+
are checked and the INSERT, UPDATE or DELETE has completed). If the
146+
trigger fires before the event, the trigger may
147+
skip the operation for the current tuple, or change the tuple
148+
being inserted (for INSERT and UPDATE operations only). If
149+
the trigger fires after the event, all changes, including the
150+
last INSERTion, UPDATE or DELETion, are "visible" to the trigger.
151+
</PARA>
152+
<PARA>
153+
Refer to the SPI and trigger programming guides for more
154+
information.
155+
</PARA>
156+
<REFSECT2 ID="R2-SQL-CREATETRIGGER-3">
157+
<REFSECT2INFO>
158+
<DATE>1998-04-15</DATE>
159+
</REFSECT2INFO>
160+
<TITLE>
161+
Notes
162+
</TITLE>
163+
<PARA>
164+
CREATE TRIGGER statement is a PostgreSQL language extension.
165+
</PARA>
166+
<PARA>
167+
Refer to the DROP TRIGGER statement for information on how to
168+
remove triggers.
169+
</PARA>
170+
171+
</REFSECT2>
172+
173+
<REFSECT1 ID="R1-SQL-CREATETRIGGER-2">
174+
<TITLE>
175+
Usage
176+
</TITLE>
177+
<PARA>
178+
Check if the specified distributor code exists in the distributors
179+
table before appending or updating a row in the table films:
180+
</PARA>
181+
<ProgramListing>
182+
CREATE TRIGGER if_dist_exists
183+
BEFORE INSERT OR UPDATE ON films FOR EACH ROW
184+
EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did');
185+
</ProgramListing>
186+
<PARA>
187+
Before cancelling a distributor or updating its code, remove every
188+
reference to the table films:
189+
</PARA>
190+
<ProgramListing>
191+
CREATE TRIGGER if_film_exists
192+
BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW
193+
EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did');
194+
</ProgramListing>
195+
</REFSECT1>
196+
197+
<REFSECT1 ID="R1-SQL-CREATETRIGGER-3">
198+
<TITLE>
199+
Compatibility
200+
</TITLE>
201+
<PARA>
202+
</PARA>
203+
204+
<REFSECT2 ID="R2-SQL-CREATETRIGGER-4">
205+
<REFSECT2INFO>
206+
<DATE>1998-04-15</DATE>
207+
</REFSECT2INFO>
208+
<TITLE>
209+
SQL92
210+
</TITLE>
211+
<PARA>
212+
There is no CREATE TRIGGER statement in SQL92.
213+
</PARA>
214+
<PARA>
215+
The second example above may also be done by using a FOREIGN KEY
216+
constraint as in:
217+
</PARA>
218+
<ProgramListing>
219+
CREATE TABLE distributors (
220+
did DECIMAL(3),
221+
name VARCHAR(40),
222+
CONSTRAINT if_film_exists FOREIGN KEY(did) REFERENCES films
223+
ON UPDATE CASCADE ON DELETE CASCADE
224+
);
225+
</ProgramListing>
226+
<PARA>
227+
However, foreign keys are not yet implemented at version 6.3.2 of
228+
PostgreSQL.
229+
</PARA>
230+
</REFENTRY>
231+
232+
<!-- Keep this comment at the end of the file
233+
Local variables:
234+
mode: sgml
235+
sgml-omittag:t
236+
sgml-shorttag:t
237+
sgml-minimize-attributes:nil
238+
sgml-always-quote-attributes:t
239+
sgml-indent-step:1
240+
sgml-indent-data:t
241+
sgml-parent-document:nil
242+
sgml-default-dtd-file:"../reference.ced"
243+
sgml-exposed-tags:nil
244+
sgml-local-catalogs:"/usr/lib/sgml/catalog"
245+
sgml-local-ecat-files:nil
246+
End:
247+
-->

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp