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

Commit769159f

Browse files
committed
Docs: minor improvements for documentation about plpgsql triggers.
Fabien Coelho, some further wordsmithing by me
1 parent8ba4ccd commit769159f

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

‎doc/src/sgml/plpgsql.sgml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3660,18 +3660,27 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
36603660
<secondary>in PL/pgSQL</secondary>
36613661
</indexterm>
36623662

3663+
<para>
3664+
<application>PL/pgSQL</application> can be used to define trigger
3665+
procedures on data changes or database events.
3666+
A trigger procedure is created with the <command>CREATE FUNCTION</>
3667+
command, declaring it as a function with no arguments and a return type of
3668+
<type>trigger</> (for data change triggers) or
3669+
<type>event_trigger</> (for database event triggers).
3670+
Special local variables named <varname>PG_<replaceable>something</></> are
3671+
automatically defined to describe the condition that triggered the call.
3672+
</para>
3673+
36633674
<sect2 id="plpgsql-dml-trigger">
36643675
<title>Triggers on Data Changes</title>
36653676

3666-
<para>
3667-
<application>PL/pgSQL</application> can be used to define trigger
3668-
procedures. A trigger procedure is created with the
3669-
<command>CREATE FUNCTION</> command, declaring it as a function with
3670-
no arguments and a return type of <type>trigger</type>. Note that
3671-
the function must be declared with no arguments even if it expects
3672-
to receive arguments specified in <command>CREATE TRIGGER</> &mdash;
3673-
trigger arguments are passed via <varname>TG_ARGV</>, as described
3674-
below.
3677+
<para>
3678+
A <link linkend="triggers">data change trigger</> is declared as a
3679+
function with no arguments and a return type of <type>trigger</>.
3680+
Note that the function must be declared with no arguments even if it
3681+
expects to receive some arguments specified in <command>CREATE TRIGGER</>
3682+
&mdash; such arguments are passed via <varname>TG_ARGV</>, as described
3683+
below.
36753684
</para>
36763685

36773686
<para>
@@ -4218,8 +4227,9 @@ SELECT * FROM sales_summary_bytime;
42184227
<title>Triggers on Events</title>
42194228

42204229
<para>
4221-
<application>PL/pgSQL</application> can be used to define event
4222-
triggers. <productname>PostgreSQL</> requires that a procedure that
4230+
<application>PL/pgSQL</application> can be used to define
4231+
<link linkend="event-triggers">event triggers</>.
4232+
<productname>PostgreSQL</> requires that a procedure that
42234233
is to be called as an event trigger must be declared as a function with
42244234
no arguments and a return type of <literal>event_trigger</>.
42254235
</para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp