Database Reference
In-Depth Information
Key
Value
greSQL to use the changed tuple by returning the string
MODIFY
from the trigger function.
The trigger name from the
CREATE TRIGGER
command.
TD["name"]
The name of the table on which the trigger occurred.
TD["table_name"]
TD["table_schema"]
The schema of the table on which the trigger occurred.
The
object identifier
(
OID
) of the table on which the trig-
ger occurred.
TD["relid"]
If the
CREATE TRIGGER
command included arguments,
they are available from
TD["args"][0]
to
TD["args"][n-1]
.
TD["args"]
In addition to doing anything you can do in ordinary PL/Python functions, such as
modifying data in tables, writing to files and sockets, and sending e-mails, you can
also affect the behavior of the triggering command.
If
TD["when"]
is
("BEFORE", "INSTEAD OF")
and
TD["level"] == "ROW"
,
you can return
SKIP
to abort the event. Returning
None
or
OK
indicates that the row
is unmodified and it is OK to continue. Returning
None
is also the default behavior
for Python if the function does a simple return or runs to the end without a return
statement; so, you don't need to do anything for this case.