↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / SQLSTATE

09000 — triggered_action_exception

触发器动作异常,多见于 contrib/spi 触发器。

英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。

当前阅读 PG 18·选择有来源记录的版本

aliases
未知
class name
Triggered Action Exception
condition name
triggered_action_exception
lang
en
sqlstate
09000

版本定义 PG 18

09000

速览 {#at-a-glance}

SQLSTATE 09000 是 ERROR 级别的触发动作条件。在固定的 PostgreSQL 18.6 扫描中,已确认的报告路径位于 contrib/spi 触发器函数:它们检查触发器参数、目标列类型、被引用元组以及 SPI 返回码。因此该代码与这些已安装的触发器函数及其表/触发器配置有关,不能把它当成所有触发器失败的统称。

含义 {#meaning}

已确认的路径包括 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"。这些模板中的关系、参数、属性、触发器和返回码来自具体失败路径。

消息 {#messages}

固定变体包括 "%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"。这些模板中的关系、参数、属性、触发器和返回码来自具体失败路径。

诊断 {#diagnosis}

先确认已安装的触发器函数和操作阶段,再把关系及触发器参数与该函数的文档契约对照。出现属性/类型消息时检查所点名的列及其类型;出现 refint 变体时检查触发器名、被引用关系以及元组或键的关系。出现 SPI_execp returned %d 时保留返回码,并检查返回该码的 SPI 调用。固定扫描没有证明所有 09000 报告都使用同一条消息。

处理 {#response}

根据消息修正触发器定义、参数列表、列类型、被引用键或 SPI 侧失败原因,确认修改后再执行触发操作。不要盲目重放写入来修复它:触发器可能已经在报错前完成部分工作,正确恢复边界取决于外层事务。若函数来自扩展或本地代码,应先检查该实现及其版本,再决定应用层的重试行为。

版本 {#versions}

锁定目录将该条件的已知下界记为 PostgreSQL 7.4。事实块列出已发布快照;源码路径状态仅限于下方固定的 PostgreSQL 18.6 资料。

相关 {#related}

0A000, 2F000

来源 {#sources}

autoinc.c、insert_username.c、moddatetime.c 和 refint.c 及其参照限制分支展示固定的报告路径;SPI 触发器文档说明扩展接口。 详见结构化证据记录,其中记录固定源码路径、扫描范围和未解决的运行边界。

比较版本

SQLSTATE 证据与已记录的运行版本

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read the fixed errcodes definition row, severity, and macro.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "09000 is triggered_action_exception in SQLSTATE Class 09."
}
claims · resolved-path
{
  "claim_id": "resolved-path",
  "limits": "This is source confirmation, not a runtime observation in this batch.",
  "method": "Read the complete source context around the resolved report group.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.spi.autoinc.18.6",
    "src.spi.insert_username.18.6",
    "src.spi.moddatetime.18.6",
    "src.spi.refint.18.6"
  ],
  "statement": "The fixed PostgreSQL 18.6 source contains the report path and message context described on the page."
}
claims · history-boundary
{
  "claim_id": "history-boundary",
  "limits": "Definition presence is not an emitting-path observation.",
  "method": "Compare canonical release-definition facts with the available history boundary.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked release definitions establish catalogue presence from the known 7.4 boundary; they do not establish a precise introducing release or runtime use."
}
messages · message.autoinc-missing-attribute
{
  "limits": "Relation and attribute names are dynamic.",
  "message_id": "message.autoinc-missing-attribute",
  "path": "",
  "position": 0,
  "raw": {
    "id": "message.autoinc-missing-attribute",
    "limits": "Relation and attribute names are dynamic.",
    "primary_template": "\"%s\" has no attribute \"%s\"",
    "severity_source": "ERROR",
    "sources": [
      "src.spi.autoinc.18.6"
    ],
    "sqlstate": "09000"
  },
  "severity": "ERROR",
  "sources": [
    "src.spi.autoinc.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "\" \" has no attribute \" \"",
      "position": 0,
      "role": "",
      "template": "\"%s\" has no attribute \"%s\""
    }
  ]
}
messages · message.autoinc-invalid-type
{
  "limits": "Attribute and relation names are dynamic.",
  "message_id": "message.autoinc-invalid-type",
  "path": "",
  "position": 1,
  "raw": {
    "id": "message.autoinc-invalid-type",
    "limits": "Attribute and relation names are dynamic.",
    "primary_template": "attribute \"%s\" of \"%s\" must be type INT4",
    "severity_source": "ERROR",
    "sources": [
      "src.spi.autoinc.18.6"
    ],
    "sqlstate": "09000"
  },
  "severity": "ERROR",
  "sources": [
    "src.spi.autoinc.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "attribute \" \" of \" \" must be type INT4",
      "position": 0,
      "role": "",
      "template": "attribute \"%s\" of \"%s\" must be type INT4"
    }
  ]
}
messages · message.insert-username-missing-attribute
{
  "limits": "Relation and attribute names are dynamic.",
  "message_id": "message.insert-username-missing-attribute",
  "path": "",
  "position": 2,
  "raw": {
    "id": "message.insert-username-missing-attribute",
    "limits": "Relation and attribute names are dynamic.",
    "primary_template": "\"%s\" has no attribute \"%s\"",
    "severity_source": "ERROR",
    "sources": [
      "src.spi.insert_username.18.6"
    ],
    "sqlstate": "09000"
  },
  "severity": "ERROR",
  "sources": [
    "src.spi.insert_username.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "\" \" has no attribute \" \"",
      "position": 0,
      "role": "",
      "template": "\"%s\" has no attribute \"%s\""
    }
  ]
}
messages · message.insert-username-invalid-type
{
  "limits": "Attribute and relation names are dynamic.",
  "message_id": "message.insert-username-invalid-type",
  "path": "",
  "position": 3,
  "raw": {
    "id": "message.insert-username-invalid-type",
    "limits": "Attribute and relation names are dynamic.",
    "primary_template": "attribute \"%s\" of \"%s\" must be type TEXT",
    "severity_source": "ERROR",
    "sources": [
      "src.spi.insert_username.18.6"
    ],
    "sqlstate": "09000"
  },
  "severity": "ERROR",
  "sources": [
    "src.spi.insert_username.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "attribute \" \" of \" \" must be type TEXT",
      "position": 0,
      "role": "",
      "template": "attribute \"%s\" of \"%s\" must be type TEXT"
    }
  ]
}
messages · message.moddatetime-missing-attribute
{
  "limits": "Relation and attribute names are dynamic.",
  "message_id": "message.moddatetime-missing-attribute",
  "path": "",
  "position": 4,
  "raw": {
    "id": "message.moddatetime-missing-attribute",
    "limits": "Relation and attribute names are dynamic.",
    "primary_template": "\"%s\" has no attribute \"%s\"",
    "severity_source": "ERROR",
    "sources": [
      "src.spi.moddatetime.18.6"
    ],
    "sqlstate": "09000"
  },
  "severity": "ERROR",
  "sources": [
    "src.spi.moddatetime.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "\" \" has no attribute \" \"",
      "position": 0,
      "role": "",
      "template": "\"%s\" has no attribute \"%s\""
    }
  ]
}
messages · message.moddatetime-invalid-type
{
  "limits": "Attribute and relation names are dynamic.",
  "message_id": "message.moddatetime-invalid-type",
  "path": "",
  "position": 5,
  "raw": {
    "id": "message.moddatetime-invalid-type",
    "limits": "Attribute and relation names are dynamic.",
    "primary_template": "attribute \"%s\" of \"%s\" must be type TIMESTAMP or TIMESTAMPTZ",
    "severity_source": "ERROR",
    "sources": [
      "src.spi.moddatetime.18.6"
    ],
    "sqlstate": "09000"
  },
  "severity": "ERROR",
  "sources": [
    "src.spi.moddatetime.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "attribute \" \" of \" \" must be type TIMESTAMP or TIMESTAMPTZ",
      "position": 0,
      "role": "",
      "template": "attribute \"%s\" of \"%s\" must be type TIMESTAMP or TIMESTAMPTZ"
    }
  ]
}
messages · message.refint-missing-key
{
  "limits": "Trigger and relation names in DETAIL are dynamic.",
  "message_id": "message.refint-missing-key",
  "path": "",
  "position": 6,
  "raw": {
    "detail_template": "Trigger \"%s\" found tuple referencing non-existent key in \"%s\".",
    "id": "message.refint-missing-key",
    "limits": "Trigger and relation names in DETAIL are dynamic.",
    "primary_template": "tuple references non-existent key",
    "severity_source": "ERROR",
    "sources": [
      "src.spi.refint.18.6"
    ],
    "sqlstate": "09000"
  },
  "severity": "ERROR",
  "sources": [
    "src.spi.refint.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "tuple references non-existent key",
      "position": 0,
      "role": "",
      "template": "tuple references non-existent key"
    },
    {
      "kind": "detail",
      "literal": "Trigger \" \" found tuple referencing non-existent key in \" \".",
      "position": 1,
      "role": "",
      "template": "Trigger \"%s\" found tuple referencing non-existent key in \"%s\"."
    }
  ]
}
messages · message.refint-spi-status
{
  "limits": "The SPI status code is dynamic.",
  "message_id": "message.refint-spi-status",
  "path": "",
  "position": 7,
  "raw": {
    "id": "message.refint-spi-status",
    "limits": "The SPI status code is dynamic.",
    "primary_template": "SPI_execp returned %d",
    "severity_source": "ERROR",
    "sources": [
      "src.spi.refint.18.6"
    ],
    "sqlstate": "09000"
  },
  "severity": "ERROR",
  "sources": [
    "src.spi.refint.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "SPI_execp returned",
      "position": 0,
      "role": "",
      "template": "SPI_execp returned %d"
    }
  ]
}
messages · message.refint-restrictive
{
  "limits": "Referencing relation names are dynamic; this is the restrictive action path.",
  "message_id": "message.refint-restrictive",
  "path": "",
  "position": 8,
  "raw": {
    "id": "message.refint-restrictive",
    "limits": "Referencing relation names are dynamic; this is the restrictive action path.",
    "primary_template": "\"%s\": tuple is referenced in \"%s\"",
    "severity_source": "ERROR",
    "sources": [
      "src.spi.refint.18.6"
    ],
    "sqlstate": "09000"
  },
  "severity": "ERROR",
  "sources": [
    "src.spi.refint.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "\" \": tuple is referenced in \" \"",
      "position": 0,
      "role": "",
      "template": "\"%s\": tuple is referenced in \"%s\""
    }
  ]
}
sources · src.errcodes.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/errcodes.txt",
  "position": 0,
  "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
  "source_id": "src.errcodes.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L115"
}
sources · src.spi.autoinc.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/spi/autoinc.c",
  "position": 1,
  "sha256": "154ac91833a2edbfb64f0d9845bff10db45b9bd9ee02e703e52650b2b1fecbf1",
  "source_id": "src.spi.autoinc.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/spi/autoinc.c"
}
sources · src.spi.insert_username.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/spi/insert_username.c",
  "position": 2,
  "sha256": "f4102a2487bfcc89d1dd821928bf9a4b9fe31abddd5ff14e8a6e75737c39e9ee",
  "source_id": "src.spi.insert_username.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/spi/insert_username.c"
}
sources · src.spi.moddatetime.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/spi/moddatetime.c",
  "position": 3,
  "sha256": "d73f1ba56e2fa74b9cfdf7b1bfa3722d242fdab08988276fc1126936c2cda4e8",
  "source_id": "src.spi.moddatetime.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/spi/moddatetime.c"
}
sources · src.spi.refint.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/spi/refint.c",
  "position": 4,
  "sha256": "4197aab0853558bac9db814363b7e294e7e3d079b95f32489fb003a8b5d2d498",
  "source_id": "src.spi.refint.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/spi/refint.c"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 5,
  "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
  "source_id": "src.calls.REL_18_6",
  "tag": "",
  "url": ""
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:e814051bc33e1114ea774cbdf8c72767fa9e2c9075d6b56bf3b92d8cb0f84b7b

正文语言: zh-Hans · english-manuals:e814051bc33e1114ea774cbdf8c72767fa9e2c9075d6b56bf3b92d8cb0f84b7b