选择 打开 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

受支持版本: 当前版本 (18) / 17 / 16 / 15 / 14
测试与开发版本: 19 / devel
不受支持的版本: 13 / 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0
历史版本PostgreSQL 9.1 已于 2016 年 10 月结束社区维护,本页译文保留供仍在使用旧版本的读者参考。新系统请看当前版本

45.42. pg_trigger #

目录pg_trigger存储表和视图上的触发器。详见CREATE TRIGGER

表 45.42. pg_trigger

Name Type References Description
tgrelid oid pg_class.oid The table this trigger is on
tgname name   Trigger name (must be unique among triggers of same table)
tgfoid oid pg_proc.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 pg_class.oid The table referenced by a referential integrity constraint
tgconstrindid oid pg_class.oid The index supporting a unique, primary key, or referential integrity constraint
tgconstraint oid pg_constraint.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 pg_attribute.attnum 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非零时,tgconstrrelidtgconstrindidtgdeferrabletginitdeferred与被引用的pg_constraint 项有很大的冗余。 但是,存在将一个不可延迟触发器关联到一个可延迟约束的可能性:外键约束可以有一些可延迟和一些不可延迟触发器。

注意

如果一个关系在本目录中拥有任何触发器,其pg_class.relhastriggers必须为真。

提交更正

译文有误、术语不当或页面显示问题,请到译文仓库 pgsty/pgdoc 报告译文问题。 英文原文本身的问题,请在当前版本的对应页面向上游反馈;上游不再修订已结束维护的版本。