pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。
pg_trigger #目录pg_trigger存储表和视图上的触发器。详见CREATE TRIGGER。
表 45.42. pg_trigger 列
| Name | Type | References | Description |
|---|---|---|---|
tgrelid |
oid |
|
The table this trigger is on |
tgname |
name |
Trigger name (must be unique among triggers of same table) | |
tgfoid |
oid |
|
The function to be called |
tgtype |
int2 |
Bit mask identifying trigger firing conditions | |
tgenabled |
char |
Controls in which session_replication_role modes the trigger fires. O = trigger fires in “origin” and “local” modes, D = trigger is disabled, R = trigger fires in “replica” mode, A = trigger fires always. |
|
tgisinternal |
bool |
True if trigger is internally generated (usually, to enforce the constraint identified by tgconstraint) |
|
tgconstrrelid |
oid |
|
The table referenced by a referential integrity constraint |
tgconstrindid |
oid |
|
The index supporting a unique, primary key, or referential integrity constraint |
tgconstraint |
oid |
|
The pg_constraint entry associated with the trigger, if any |
tgdeferrable |
bool |
True if constraint trigger is deferrable | |
tginitdeferred |
bool |
True if constraint trigger is initially deferred | |
tgnargs |
int2 |
Number of argument strings passed to trigger function | |
tgattr |
int2vector |
|
Column numbers, if trigger is column-specific; otherwise an empty array |
tgargs |
bytea |
Argument strings to pass to trigger, each NULL-terminated | |
tgqual |
pg_node_tree |
Expression tree (in nodeToString() representation) for the trigger's WHEN condition, or null if none |
当前,列限定触发器只支持UPDATE事件,因此tgattr只用于这种事件类型。tgtype也可以包含用于其他事件类型的位,但那些事件类型对应的是表级触发器,并且会忽略tgattr。
当tgconstraint非零时,tgconstrrelid、tgconstrindid、tgdeferrable和tginitdeferred与被引用的pg_constraint 项有很大的冗余。 但是,存在将一个不可延迟触发器关联到一个可延迟约束的可能性:外键约束可以有一些可延迟和一些不可延迟触发器。
如果一个关系在本目录中拥有任何触发器,其pg_class.relhastriggers必须为真。
译文有误、术语不当或页面显示问题,请到译文仓库 pgsty/pgdoc 报告译文问题。 英文原文本身的问题,请在当前版本的对应页面向上游反馈;上游不再修订已结束维护的版本。