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

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

Wiki / SQLSTATE

22035 — no_sql_json_item

指定 SQL/JSON path 没有找到任何项。

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

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

aliases
未知
class name
Data Exception
condition name
no_sql_json_item
lang
en
sqlstate
22035

版本定义 PG 18

22035

速览 {#at-a-glance}

SQL/JSON path 没有找到请求的项。固定表达式执行路径报告 no SQL/JSON item found for specified path。

报文 {#messages}

ERROR 行为使用以下首要文本:

| 上下文 | 首要文本 | | --- | --- | | 有名的 JSON_TABLE/SQL/JSON 列 | no SQL/JSON item found for specified path of column "%s" | | 没有列名 | no SQL/JSON item found for specified path |

含义 {#meaning}

JSON path 可以产生空结果而不立即抛错。JsonPathQuery 和 JsonPathValue 会把零匹配标记为 empty;随后 SQL/JSON 表达式执行器应用 ON EMPTY,如果没有单独的 ON EMPTY 行为,也会使用非 ERROR 的 ON ERROR 行为。只有有效行为是 ERROR 时,执行器才报告 22035,并根据是否有列名选择对应首要文本。jsonb_path_query_first 等辅助函数可以直接把无匹配返回为 NULL,因此 22035 不是所有空 path 结果的统称。

诊断 {#diagnosis}

记录操作、path、列名以及 ON EMPTY/ON ERROR 子句。区分预期的 NULL/默认回退和会进入 22035 的 ERROR 行为。strict 与 lax 的 path 求值以及 silent 模式可能改变结构问题是变成空结果还是被抑制的求值错误;多项结果和无效下标分别使用 22034 与 22033。

处理 {#response}

如果必须找到项,修正 path、输入文档或列映射;如果无匹配是允许的,则使用文档规定的 ON EMPTY 行为,或使用明确把无匹配返回 NULL/空结果的辅助函数。不要用 wrapper 解决无项问题,wrapper 处理的是多项基数。如果 ERROR 发生在显式事务中,应先 ROLLBACK 或回滚到既有保存点再重试;自动提交可重试修正后的表达式。

版本 {#versions}

锁定目录从 12.0 起记录该条件;本页固定 SQL/JSON 执行器路径为 PostgreSQL 18.6。未声称本页有自然运行观察。

相关 {#related}

22033、22034

来源 {#sources}

JSON path 辅助函数在 src/backend/utils/adt/jsonpath_exec.c#L3880-4070 中标记空结果。SQL/JSON 的 ON EMPTY/ON ERROR 处理及两个 22035 首要文本见 src/backend/executor/execExprInterp.c#L4940-5080。结构化证据记录保留空结果与行为边界;本页未运行自然案例。

比较版本

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

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read fixed definition.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "22035 is no_sql_json_item in SQLSTATE Class 22."
}
claims · resolved-path
{
  "claim_id": "resolved-path",
  "limits": "Source confirmation is not a natural runtime observation.",
  "method": "Read JsonPathValue empty handling and ExecEvalJsonExprPath ON EMPTY/ON ERROR branches.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.path.0",
    "src.execExpr.json-empty-error"
  ],
  "statement": "The fixed SQL/JSON expression executor marks an empty path result and applies ON EMPTY or a non-ERROR ON ERROR behavior; only the ERROR behavior reaches the 22035 ereport, with column-aware and column-less primary variants. JSON path query helpers that return NULL/empty results directly are therefore not blanket 22035 emitters."
}
claims · history
{
  "claim_id": "history",
  "limits": "",
  "method": "Use catalogue boundary.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked catalogue records 22035 from 12.0 without proving exact implementation introduction."
}
messages · message.0
{
  "limits": "",
  "message_id": "message.0",
  "path": "",
  "position": 0,
  "raw": {
    "id": "message.0",
    "primary_template": "no SQL/JSON item found for specified path of column \"%s\"",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0"
    ],
    "sqlstate": "22035"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "no SQL/JSON item found for specified path of column \" \"",
      "position": 0,
      "role": "",
      "template": "no SQL/JSON item found for specified path of column \"%s\""
    }
  ]
}
messages · message.no-column
{
  "limits": "",
  "message_id": "message.no-column",
  "path": "",
  "position": 1,
  "raw": {
    "id": "message.no-column",
    "primary_template": "no SQL/JSON item found for specified path",
    "severity_source": "ERROR",
    "sources": [
      "src.execExpr.json-empty-error"
    ],
    "sqlstate": "22035"
  },
  "severity": "ERROR",
  "sources": [
    "src.execExpr.json-empty-error"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "no SQL/JSON item found for specified path",
      "position": 0,
      "role": "",
      "template": "no SQL/JSON item found for specified path"
    }
  ]
}
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#L220"
}
sources · src.path.0
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/executor/execExprInterp.c",
  "position": 1,
  "sha256": "05cbc1cdfd1d091b02045ee55b37147f69be8f0fcb23274751820cc09db33564",
  "source_id": "src.path.0",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/execExprInterp.c#L5072"
}
sources · src.execExpr.json-empty-error
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/executor/execExprInterp.c",
  "position": 2,
  "sha256": "05cbc1cdfd1d091b02045ee55b37147f69be8f0fcb23274751820cc09db33564",
  "source_id": "src.execExpr.json-empty-error",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/execExprInterp.c#L4940"
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:3cc4ccc58787328f41423ea8fb3b20c08c515005980eb6da080920fd59f05ea7

正文语言: zh-Hans · english-manuals:3cc4ccc58787328f41423ea8fb3b20c08c515005980eb6da080920fd59f05ea7