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

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

Wiki / SQLSTATE

00000 — successful_completion

命令成功完成,不是错误条件。

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

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

aliases
未知
class name
Successful Completion
condition name
successful_completion
lang
en
sqlstate
00000

版本定义 PG 18

00000 — successful_completion

速览 {#at-a-glance}

00000 是成功完成 SQLSTATE。PostgreSQL 错误机制在没有设置更具体代码且级别低于 WARNING 时默认选择它;成功命令不需要错误消息。

含义 {#meaning}

elog.c 的 errstart 按消息级别选择默认 SQLSTATE;低于 WARNING 时设置 ERRCODE_SUCCESSFUL_COMPLETION。这是错误机制中的源码级默认值,不是应用错误机制,也不表示普通命令会携带 ErrorResponse。

消息与诊断 {#messages}

命令完成通常由成功结果和命令标签表示,不携带 ErrorResponse SQLSTATE。在固定的 elog 路径中,只有没有更具体代码且消息级别低于 WARNING 时,错误机制才把 00000 作为默认值初始化。诊断消息必须同时保留实际协议消息类型和严重性;00000 不是 ERROR 的默认码,也不会把成功结果变成 ErrorResponse。

诊断 {#diagnosis}

先检查客户端结果状态和命令标签。如果客户端把 00000 与失败状态或 ErrorResponse 一起报告,应调查来源和客户端 API 的状态处理,不能把它解释为通常成功,也不要凭空寻找错误 detail。

处理 {#response}

将成功命令结果按完成处理。若 NoticeResponse 携带 00000,应把通知与命令结果分开记录;只有两者冲突时才调查客户端状态处理。不要仅因出现此代码就重试成功命令。

版本 {#versions}

锁定目录从 9.0.23 到 18.6 以及 19 Beta 3 均有 00000,known_present_by 为 7.4。18.6 固定的 elog.c 路径显示低于 WARNING 时的默认赋值;这不是每个客户端协议的运行实测。

相关 {#related}

01000 是警告类;02000 是无数据条件;P0002 是 PL/pgSQL 的 no_data_found。

来源 {#sources}

  • errcodes.txt — 定义,SHA-256 6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba.
  • elog.c — 固定路径,SHA-256 766d30a426ba1d9597657bd46fb890da3e37e4ae53a83d1245bf082ed9433c33。
  • 结构化证据 — 固定来源、消息和运行边界。

比较版本

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

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read the fixed errcodes definition row and macro.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "00000 is successful_completion in Class 00."
}
claims · default-selection
{
  "claim_id": "default-selection",
  "limits": "This is only the low-level default for levels below WARNING; it does not establish a normal ErrorResponse or successful command protocol result, and no natural runtime is claimed.",
  "method": "Read the default sqlerrcode selection in errstart().",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.elog.18.6"
  ],
  "statement": "In the fixed 18.6 error machinery, levels below WARNING initialize the SQLSTATE to ERRCODE_SUCCESSFUL_COMPLETION when no more specific code is supplied."
}
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.elog.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/error/elog.c",
  "position": 1,
  "sha256": "766d30a426ba1d9597657bd46fb890da3e37e4ae53a83d1245bf082ed9433c33",
  "source_id": "src.elog.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/error/elog.c"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 2,
  "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
  "source_id": "src.calls.REL_18_6",
  "tag": "",
  "url": ""
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:11e99deac7d62e2437842ab7980bf9f20df0e7c3070f3d49e70ce6fccde9945b

正文语言: zh-Hans · english-manuals:11e99deac7d62e2437842ab7980bf9f20df0e7c3070f3d49e70ce6fccde9945b