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

Commit33a82e7

Browse files
committed
Here's some matching documentation, including some other
undocumented items in TD.Should doc patches alse be sent to pgsql-patches, or do Ihave to subscribe to pgsql-docs?The archive link for pgsql-patches is broken, and I don'tsee any patches in spot checking the archive for pgsql-docs.-Brad McLean.
1 parent148f94b commit33a82e7

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

‎doc/src/sgml/plpython.sgml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/plpython.sgml,v 1.2 2001/09/10 21:58:47 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/plpython.sgml,v 1.3 2001/09/12 03:58:15 momjian Exp $ -->
22

33
<chapter id="plpython">
44
<title>PL/Python - Python Procedural Language</title>
@@ -58,13 +58,7 @@ def __plpython_procedure_myfunc_23456():
5858
The global dictionary SD is available to store data between
5959
function calls. This variable is private static data. The global
6060
dictionary GD is public data, available to all python functions
61-
within a backend. Use with care. When the function is used in a
62-
trigger, the triggers tuples are in <literal>TD["new"]</literal> and/or <literal>TD["old"]</literal>
63-
depending on the trigger event. Return 'None' or "OK" from the
64-
python function to indicate the tuple is unmodified, "SKIP" to
65-
abort the event, or "MODIFIED" to indicate you've modified the
66-
tuple. If the trigger was called with arguments they are available
67-
in <literal>TD["args"][0] to TD["args"][(n -1)]</literal>.
61+
within a backend. Use with care.
6862
</para>
6963

7064
<para>
@@ -75,6 +69,26 @@ def __plpython_procedure_myfunc_23456():
7569
dictionary, as mentioned above.
7670
</para>
7771

72+
</para>
73+
When a function is used in a trigger, the dictionary TD contains
74+
transaction related values. The trigger tuples are in TD["new"]
75+
and/or TD["old"] depending on the trigger event. TD["event"]
76+
contains the event as a string ("INSERT", "UPDATE", "DELETE", or
77+
"UNKNOWN"). TD["when"] contains one of ("BEFORE", "AFTER", or
78+
"UNKNOWN"). TD["level"] contains one of ("ROW", "STATEMENT", or
79+
"UNKNOWN"). TD["name"] contains the trigger name, and TD["relid"]
80+
contains the relation id of the table on which the trigger occurred.
81+
If the trigger was called with arguments they are available
82+
in TD["args"][0] to TD["args"][(n -1)]
83+
</para>
84+
85+
<para>
86+
If the trigger 'when' is "BEFORE", you may Return 'None' or "OK"
87+
from the python function to indicate the tuple is unmodified,
88+
"SKIP" to abort the event, or "MODIFIED" to indicate you've
89+
modified the tuple.
90+
</para>
91+
7892
<para>
7993
The PL/Python language module automatically imports a Python module
8094
called <literal>plpy</literal>. The functions and constants in

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp