百科 / 错误代码 / Class 09 触发动作异常
09000 triggered_action_exception
ERROR 源码确认 参考 未实测
- 条件名
triggered_action_exception- 宏名称
ERRCODE_TRIGGERED_ACTION_EXCEPTION- 启用版本
- 7.4
- 状态
- 活跃
版本覆盖
速览
SQLSTATE 09000 是 ERROR 级别的触发动作条件。在固定的 PostgreSQL 18.6 扫描中,已确认的报告路径位于 contrib/spi 触发器函数:它们检查触发器参数、目标列类型、被引用元组以及 SPI 返回码。因此该代码与这些已安装的触发器函数及其表/触发器配置有关,不能把它当成所有触发器失败的统称。
含义
已确认的路径包括 autoinc.c、insert_username.c、moddatetime.c 和 refint.c。消息变体包括 "%s" has no attribute "%s"、attribute "%s" of "%s" must be type INT4、... TEXT 以及 ... TIMESTAMP or TIMESTAMPTZ。参照完整性路径还会报告 tuple references non-existent key,并带有 Trigger "%s" found tuple referencing non-existent key in "%s". detail;SPI 失败可报告 SPI_execp returned %d,RESTRICT 动作还可报告 "%s": tuple is referenced in "%s"。这些模板中的关系、参数、属性、触发器和返回码来自具体失败路径。
消息
固定变体包括 "%s" has no attribute "%s"、attribute "%s" of "%s" must be type INT4、TEXT 或 TIMESTAMP or TIMESTAMPTZ。参照完整性路径还会报告 tuple references non-existent key,并带有 Trigger "%s" found tuple referencing non-existent key in "%s". detail;SPI 失败可报告 SPI_execp returned %d,RESTRICT 动作还可报告 "%s": tuple is referenced in "%s"。这些模板中的关系、参数、属性、触发器和返回码来自具体失败路径。
报文模板
源码里的格式串,不是某一次运行的输出。%s 之类是占位符,实际报文会填入对象名与取值。适用范围一栏是核验时留下的原始英文记录,未经翻译。
"%s" has no attribute "%s"
来源:contrib/spi/autoinc.c @ REL_18_6
适用范围:Relation and attribute names are dynamic.
attribute "%s" of "%s" must be type INT4
来源:contrib/spi/autoinc.c @ REL_18_6
适用范围:Attribute and relation names are dynamic.
"%s" has no attribute "%s"
来源:contrib/spi/insert_username.c @ REL_18_6
适用范围:Relation and attribute names are dynamic.
attribute "%s" of "%s" must be type TEXT
来源:contrib/spi/insert_username.c @ REL_18_6
适用范围:Attribute and relation names are dynamic.
"%s" has no attribute "%s"
来源:contrib/spi/moddatetime.c @ REL_18_6
适用范围:Relation and attribute names are dynamic.
attribute "%s" of "%s" must be type TIMESTAMP or TIMESTAMPTZ
来源:contrib/spi/moddatetime.c @ REL_18_6
适用范围:Attribute and relation names are dynamic.
tuple references non-existent key
Trigger "%s" found tuple referencing non-existent key in "%s".
来源:contrib/spi/refint.c @ REL_18_6
适用范围:Trigger and relation names in DETAIL are dynamic.
"%s": tuple is referenced in "%s"
来源:contrib/spi/refint.c @ REL_18_6
适用范围:Referencing relation names are dynamic; this is the restrictive action path.
诊断
先确认已安装的触发器函数和操作阶段,再把关系及触发器参数与该函数的文档契约对照。出现属性/类型消息时检查所点名的列及其类型;出现 refint 变体时检查触发器名、被引用关系以及元组或键的关系。出现 SPI_execp returned %d 时保留返回码,并检查返回该码的 SPI 调用。固定扫描没有证明所有 09000 报告都使用同一条消息。
处理
根据消息修正触发器定义、参数列表、列类型、被引用键或 SPI 侧失败原因,确认修改后再执行触发操作。不要盲目重放写入来修复它:触发器可能已经在报错前完成部分工作,正确恢复边界取决于外层事务。若函数来自扩展或本地代码,应先检查该实现及其版本,再决定应用层的重试行为。
版本
锁定目录将该条件的已知下界记为 PostgreSQL 7.4。事实块列出已发布快照;源码路径状态仅限于下方固定的 PostgreSQL 18.6 资料。
来源
- 上游源码 src/backend/utils/errcodes.txt 第 115 行
- 上游源码 contrib/spi/autoinc.c
- 上游源码 contrib/spi/insert_username.c
- 上游源码 contrib/spi/moddatetime.c
- 上游源码 contrib/spi/refint.c
- 核验材料 raw/calls/REL_18_6.jsonl
证据
断言
每条断言都写明了是怎么核实的,以及它不覆盖什么。这一层是核验时留下的原始英文记录,照原样呈现,未经翻译。
-
09000 is triggered_action_exception in SQLSTATE Class 09.
-
The fixed PostgreSQL 18.6 source contains the report path and message context described on the page.
-
The locked release definitions establish catalogue presence from the known 7.4 boundary; they do not establish a precise introducing release or runtime use.