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

Commit50ef9f7

Browse files
committed
Small wording improvement and clarification in PL/pgSQL trigger documentation
1 parent0d399d5 commit50ef9f7

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

‎doc/src/sgml/plpgsql.sgml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.148 2009/12/19 01:49:02 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.149 2009/12/28 19:11:51 petere Exp $ -->
22

33
<chapter id="plpgsql">
44
<title><application>PL/pgSQL</application> - <acronym>SQL</acronym> Procedural Language</title>
@@ -3197,16 +3197,26 @@ RAISE unique_violation USING MESSAGE = 'Duplicate user ID: ' || user_id;
31973197
for this row). If a nonnull
31983198
value is returned then the operation proceeds with that row value.
31993199
Returning a row value different from the original value
3200-
of <varname>NEW</> alters the row that will be inserted or updated
3201-
(but has no direct effect in the <command>DELETE</> case).
3202-
To alter the row to be stored, it is possible to replace single values
3203-
directly in <varname>NEW</> and return the modified <varname>NEW</>,
3204-
or to build a complete new record/row to return.
3200+
of <varname>NEW</> alters the row that will be inserted or
3201+
updated. Thus, if the trigger function wants the triggering
3202+
action to succeed normally without altering the row
3203+
value, <varname>NEW</varname> (or a value equal thereto) has to be
3204+
returned. To alter the row to be stored, it is possible to
3205+
replace single values directly in <varname>NEW</> and return the
3206+
modified <varname>NEW</>, or to build a complete new record/row to
3207+
return. In the case of a before-trigger
3208+
on <command>DELETE</command>, the returned value has no direct
3209+
effect, but it has to be nonnull to allow the trigger action to
3210+
proceed. Note that <varname>NEW</varname> is null
3211+
in <command>DELETE</command> triggers, so returning that is
3212+
usually not sensible. A useful idiom in <command>DELETE</command>
3213+
triggers might be to return <varname>OLD</varname>.
32053214
</para>
32063215

32073216
<para>
3208-
The return value of a <literal>BEFORE</> or <literal>AFTER</>
3209-
statement-level trigger or an <literal>AFTER</> row-level trigger is
3217+
The return value of a row-level trigger
3218+
fired <literal>AFTER</literal> or a statement-level trigger
3219+
fired <literal>BEFORE</> or <literal>AFTER</> is
32103220
always ignored; it might as well be null. However, any of these types of
32113221
triggers might still abort the entire operation by raising an error.
32123222
</para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp