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

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

Wiki / SQLSTATE

40003 — statement_completion_unknown(语句完成状态未知)

语句完成状态不确定,重试前先核对业务状态。

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

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

aliases
未知
class name
Transaction Rollback
condition name
statement_completion_unknown
lang
en
sqlstate
40003

版本定义 PG 18

40003 — statement_completion_unknown(语句完成状态未知)

速览 {#at-a-glance}

40003 描述语句完成状态不确定,通常是连接或协议边界上的结果核对问题。本批固定核心扫描没有提供安全的 SQL-only 自然触发方式。客户端超时或伪造 RAISE 都不能证明服务器完成状态不确定;重试前先核对持久化业务状态。

含义 {#meaning}

40003 表示语句完成状态未知:连接或传输失败后,客户端无法判断服务器是否已经完成语句。它是结果可知性的边界,不能证明语句失败,也不能指示盲目回滚。

诊断 {#diagnosis}

用请求标识或幂等键关联服务器日志、后端活动、提交记录和持久化业务状态。套接字异常通常没有服务器 SQLSTATE,固定扫描也没有安全的核心纯 SQL 40003 触发器。客户端超时、断链,以及在新会话上执行 ROLLBACK 都是独立事实,不能证明原语句已撤销。

处理 {#response}

重试前先核对:在新的健康会话上查询权威持久化状态;只有同时匹配原请求和业务结果后,幂等键才能表示“已处理”;再由应用判断是否可重复执行。不要声称通用重试或回滚能解决未知完成状态,也不要用 RAISE 或本地超时伪造 40003。

版本 {#versions}

上面的锁定事实表记录项目快照范围内的目录存在情况。固定源码证据只覆盖下面声明的路径;不能仅从定义推导精确行为引入版本或更广的运行覆盖。

相关 {#related}

可对照服务器明确确认可重试的40001 序列化失败;40003 必须先核对结果。

来源 {#sources}

  • src.errcodes.18.6(SHA-256 6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba)
  • 固定调用扫描 src.calls.REL_18_6(SHA-256 9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf)

比较版本

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

cases · statement_completion_boundary
{
  "assertions": [],
  "case_id": "statement_completion_boundary",
  "cleanup": "Drop the case schema with an owner connection.",
  "has_snippet": false,
  "position": 0,
  "preconditions": [
    "A runner-owned disposable target is provisioned."
  ],
  "repair": "When completion is uncertain, reconcile durable business state before retrying; this page does not claim a SQL-only reproduction.",
  "trigger": "No connection-loss or uncertain-completion success claim is fabricated.",
  "versions": [
    "10",
    "18"
  ]
}
claims · identity
{
  "claim_id": "identity",
  "limits": "This records the protocol definition and does not imply a natural PostgreSQL throw path.",
  "method": "Read the fixed errcodes.txt row and macro mapping.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "40003 is the statement_completion_unknown condition in Class 40."
}
claims · no-safe-natural-case
{
  "claim_id": "no-safe-natural-case",
  "limits": "This is a bounded source/definition result, not proof that every extension or injected fault cannot emit the code.",
  "method": "Review the fixed call scan for resolved 40003 call groups and reject artificial RAISE or relabeling.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.calls.REL_18_6"
  ],
  "statement": "No distinct safe natural core runtime case for 40003 was selected from the fixed call scan."
}
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"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 1,
  "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
  "source_id": "src.calls.REL_18_6",
  "tag": "",
  "url": ""
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:20281c36389be9fa160fe572fa56f0e2f3708279c3f32ce0d33c3c05ce3e34d7

正文语言: zh-Hans · english-manuals:20281c36389be9fa160fe572fa56f0e2f3708279c3f32ce0d33c3c05ce3e34d7