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

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

Wiki / SQLSTATE

02000 — no_data

无数据条件,不等同于查询返回零行。

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

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

aliases
未知
class name
No Data (this is also a warning class per the SQL standard)
condition name
no_data
lang
en
sqlstate
02000

版本定义 PG 18

02000 — no_data

速览 {#at-a-glance}

02000 在 18.6 的 contrib/amcheck/verify_nbtree.c 中有确认的 DEBUG1/DEBUG2 内部索引检查路径。下面详列的三个组都确认是 DEBUG1;这些诊断不同于普通查询无行,也不是通用客户端错误。

含义 {#meaning}

确认的 18.6 实现位于 contrib/amcheck/verify_nbtree.c,索引一致性诊断在 DEBUG1 或 DEBUG2 使用 ERRCODE_NO_DATA。这是内部诊断用途,不是普通 SELECT 无行语义。本证据具体展开三个代表性组;源码中的其他路径不在这组选定消息内。

消息与诊断 {#messages}

本次选定的固定消息组为:

  • DEBUG1、内部 errmsg_internal:harmless fast root mismatch in index "%s",内部 detail 为 Fast root block %u (level %u) differs from true root block %u (level %u).。源码明确把它标为 harmless。
  • DEBUG1、内部 errmsg_internal:block %u of index "%s" concurrently deleted。这个分支的确认组没有 detail 或 hint。
  • DEBUG1、普通 errmsg/errdetail/errhint:index uniqueness can not be checked for index tid=(%u,%u) in index "%s",detail 为 It doesn't have visible heap tids and key is equal to the tid=(%u,%u)%s (points to heap tid=(%u,%u)).,hint 为 VACUUM the table and repeat the check.。VACUUM hint 只属于这个组。

诊断 {#diagnosis}

若代码来自 amcheck,记录检查、索引、block/TID 上下文和服务器日志严重级别。fast-root mismatch 已被源码标为 harmless,应结合上下文记录,不要自动当作损坏修复。对于并发删除,应关联并发操作或快照,待相关活动稳定后再决定是否重跑。对于 uniqueness-uncheckable 组,应检查指定索引,并只在该组给出提示时执行 VACUUM 后重跑。应用无行处理应检查实际命令结果或过程条件;PL/pgSQL 的 NO_DATA_FOUND 是 P0002,不是 02000 的通用同义词。

处理 {#response}

按分支处理:不要把 harmless fast-root 诊断自动变成修复;并发删除要调查并发状态;只有 uniqueness-uncheckable 组给出该提示时,才先执行 VACUUM 再重跑。不要要求每个 DEBUG 发现都做维护,也不要仅因 SQLSTATE 属于 02 类就给普通 SELECT 加无行异常或重试。

版本 {#versions}

02000 在锁定目录 9.0.23 至 18.6 以及 19 Beta 3 中存在,known_present_by 为 7.4。18.6 证据覆盖 amcheck DEBUG 路径;其他来源需要独立源码证据。

相关 {#related}

P0002 是 PL/pgSQL no_data_found;02001 涉及额外动态结果集;00000 是成功完成。

来源 {#sources}

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

比较版本

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": "02000 is no_data in SQLSTATE Class 02."
}
claims · source-path
{
  "claim_id": "source-path",
  "limits": "This confirms a source path and current wording; it is not a runtime observation of every installation.",
  "method": "Read the fixed source context around the SQLSTATE macro.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.verify_nbtree.18.6"
  ],
  "statement": "A fixed PostgreSQL 18.6 source path uses this SQLSTATE at the stated severity and operation."
}
claims · message-scope
{
  "claim_id": "message-scope",
  "limits": "No natural amcheck runtime or exhaustive producer inventory is claimed.",
  "method": "Compare the selected message groups with the fixed verify_nbtree.c call scan.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.verify_nbtree.18.6"
  ],
  "statement": "The authored evidence expands three representative amcheck groups, each resolved at DEBUG1; the fixed source also contains other 02000 DEBUG1/DEBUG2 paths that are outside this selected message set."
}
messages · amcheck-fast-root-mismatch
{
  "limits": "Resolved group is DEBUG1 and internal; the fixed source labels this mismatch harmless, so it does not imply corruption or a VACUUM requirement.",
  "message_id": "amcheck-fast-root-mismatch",
  "path": "L508-L514",
  "position": 0,
  "raw": {
    "detail_template": "Fast root block %u (level %u) differs from true root block %u (level %u).",
    "id": "amcheck-fast-root-mismatch",
    "internal": true,
    "limits": "Resolved group is DEBUG1 and internal; the fixed source labels this mismatch harmless, so it does not imply corruption or a VACUUM requirement.",
    "path": "L508-L514",
    "primary_template": "harmless fast root mismatch in index \"%s\"",
    "severity": "DEBUG1",
    "source_ids": [
      "src.verify_nbtree.18.6"
    ],
    "sources": [
      "src.verify_nbtree.18.6"
    ],
    "sqlstate": "02000"
  },
  "severity": "DEBUG1",
  "sources": [
    "src.verify_nbtree.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "harmless fast root mismatch in index \" \"",
      "position": 0,
      "role": "",
      "template": "harmless fast root mismatch in index \"%s\""
    },
    {
      "kind": "detail",
      "literal": "Fast root block (level ) differs from true root block (level ).",
      "position": 1,
      "role": "",
      "template": "Fast root block %u (level %u) differs from true root block %u (level %u)."
    }
  ]
}
messages · amcheck-concurrent-delete
{
  "limits": "Resolved group is DEBUG1 and internal; this branch has no VACUUM hint and requires concurrency context.",
  "message_id": "amcheck-concurrent-delete",
  "path": "L691-L694",
  "position": 1,
  "raw": {
    "id": "amcheck-concurrent-delete",
    "internal": true,
    "limits": "Resolved group is DEBUG1 and internal; this branch has no VACUUM hint and requires concurrency context.",
    "path": "L691-L694",
    "primary_template": "block %u of index \"%s\" concurrently deleted",
    "severity": "DEBUG1",
    "source_ids": [
      "src.verify_nbtree.18.6"
    ],
    "sources": [
      "src.verify_nbtree.18.6"
    ],
    "sqlstate": "02000"
  },
  "severity": "DEBUG1",
  "sources": [
    "src.verify_nbtree.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "block of index \" \" concurrently deleted",
      "position": 0,
      "role": "",
      "template": "block %u of index \"%s\" concurrently deleted"
    }
  ]
}
messages · amcheck-uniqueness-uncheckable
{
  "limits": "Resolved group is DEBUG1; the VACUUM hint belongs to this uniqueness-check branch only.",
  "message_id": "amcheck-uniqueness-uncheckable",
  "path": "L992-L1001",
  "position": 2,
  "raw": {
    "detail_template": "It doesn't have visible heap tids and key is equal to the tid=(%u,%u)%s (points to heap tid=(%u,%u)).",
    "hint_template": "VACUUM the table and repeat the check.",
    "id": "amcheck-uniqueness-uncheckable",
    "limits": "Resolved group is DEBUG1; the VACUUM hint belongs to this uniqueness-check branch only.",
    "path": "L992-L1001",
    "primary_template": "index uniqueness can not be checked for index tid=(%u,%u) in index \"%s\"",
    "severity": "DEBUG1",
    "source_ids": [
      "src.verify_nbtree.18.6"
    ],
    "sources": [
      "src.verify_nbtree.18.6"
    ],
    "sqlstate": "02000"
  },
  "severity": "DEBUG1",
  "sources": [
    "src.verify_nbtree.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "index uniqueness can not be checked for index tid=( , ) in index \" \"",
      "position": 0,
      "role": "",
      "template": "index uniqueness can not be checked for index tid=(%u,%u) in index \"%s\""
    },
    {
      "kind": "detail",
      "literal": "It doesn't have visible heap tids and key is equal to the tid=( , ) (points to heap tid=( , )).",
      "position": 1,
      "role": "",
      "template": "It doesn't have visible heap tids and key is equal to the tid=(%u,%u)%s (points to heap tid=(%u,%u))."
    },
    {
      "kind": "hint",
      "literal": "VACUUM the table and repeat the check.",
      "position": 2,
      "role": "",
      "template": "VACUUM the table and repeat the check."
    }
  ]
}
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.verify_nbtree.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/amcheck/verify_nbtree.c",
  "position": 1,
  "sha256": "a59ae7540a990e5a70e8eb9cedbcad7c62e3e86b1ad426142c8931ee188b752d",
  "source_id": "src.verify_nbtree.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/amcheck/verify_nbtree.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:e7133f6c87a979de1e5aaf73065ffea1b9f53751187a385956b200675a18f58a

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