Database Reference
In-Depth Information
Variables
passed
to
the
PL/pgSQL
TRIGGER function
The following is a complete list of variables available to a trigger function written in
PL/pgSQL:
OLD
,
NEW
RECORD before
and
after
images of the row the trigger is
called on.
OLD
is unassigned for
INSERT
and
NEW
is
unassigned for
DELETE
.
Both are
UNASSIGNED
in statement-level triggers.
The name of the trigger (this and following from the
trigger definition).
TG_NAME
name
tex
t
One of
BEFORE
,
AFTER
, or
INSTEAD OF
.
TG_WHEN
ROW
or
STATEMENT
.
TG_LEVEL
text
One of
INSERT
,
UPDATE
,
DELETE
, or
TRUNCATE
.
TG_OP
text
OID
of the table the trigger is created on.
TG_RELID
oid
The name of the table (old spelling
TG_RELNAME
is
deprecated but still available).
TG_TABLE_NAME
name