↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / SQLSTATE

02000 — no_data

02000 has confirmed 18.6 DEBUG1/DEBUG2 paths in contrib/amcheck/verify_nbtree.c for internal index-check conditions. The three groups detailed below are each DEBUG1; they are not the same as a normal query returning zero rows and are not a generic client error.

English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

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

Definition PG 18

02000 — no_data

At a glance {#at-a-glance}

02000 has confirmed 18.6 DEBUG1/DEBUG2 paths in contrib/amcheck/verify_nbtree.c for internal index-check conditions. The three groups detailed below are each DEBUG1; they are not the same as a normal query returning zero rows and are not a generic client error.

Meaning {#meaning}

The confirmed 18.6 implementation is in contrib/amcheck/verify_nbtree.c, where index consistency diagnostics use ERRCODE_NO_DATA at DEBUG1 or DEBUG2. This is an internal diagnostic use, not ordinary SELECT no-row semantics. The authored evidence expands three representative groups; other source paths are outside that selected message set.

Messages and diagnostics {#messages}

The selected fixed groups are:

  • DEBUG1, internal errmsg_internal: harmless fast root mismatch in index "%s", with internal detail Fast root block %u (level %u) differs from true root block %u (level %u). The source labels this condition harmless.
  • DEBUG1, internal errmsg_internal: block %u of index "%s" concurrently deleted. This branch has no detail or hint in the resolved group.
  • DEBUG1, ordinary errmsg/errdetail/errhint: index uniqueness can not be checked for index tid=(%u,%u) in index "%s", with detail It doesn't have visible heap tids and key is equal to the tid=(%u,%u)%s (points to heap tid=(%u,%u)). and hint VACUUM the table and repeat the check. The VACUUM hint belongs to this group only.

Diagnosis {#diagnosis}

If this code comes from amcheck, identify the check, index, block/TID context and server log severity. Treat a fast-root mismatch as the source labels it: a harmless diagnostic requiring context, not automatic corruption repair. For a concurrently deleted block, correlate the concurrent operation or snapshot and rerun only after the relevant activity has settled. For the uniqueness-uncheckable group, inspect the named index and follow its specific VACUUM hint before repeating the check. For application no-row handling, inspect the command result or procedural condition actually returned; PL/pgSQL NO_DATA_FOUND is P0002, not a blanket synonym for 02000.

Response {#response}

Apply the branch-specific guidance: do not turn the harmless fast-root diagnostic into an automatic repair; investigate concurrent state for a concurrent deletion; and use VACUUM before repeating the check only when the uniqueness-uncheckable group supplies that hint. Do not require maintenance for every DEBUG finding, and do not add a no-row exception or retry to ordinary SELECT code solely because the SQLSTATE class is 02.

Versions {#versions}

02000 is present from the locked 9.0.23 snapshot through 18.6 and 19 Beta 3, with known_present_by 7.4. The fixed 18.6 evidence covers the amcheck DEBUG paths; other producers need separate source evidence.

Related {#related}

P0002 is PL/pgSQL no_data_found; 02001 concerns additional dynamic result sets; 00000 is successful completion.

Sources {#sources}

  • errcodes.txt — definition, SHA-256 6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba.
  • verify_nbtree.c — fixed path, SHA-256 a59ae7540a990e5a70e8eb9cedbcad7c62e3e86b1ad426142c8931ee188b752d.
  • Structured evidence — fixed sources, message groups, and runtime boundary.

Compare versions

SQLSTATE evidence and recorded runtime versions

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": ""
}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · english-manuals:e7133f6c87a979de1e5aaf73065ffea1b9f53751187a385956b200675a18f58a

Text language: en · english-manuals:e7133f6c87a979de1e5aaf73065ffea1b9f53751187a385956b200675a18f58a