选择 打开 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 错误代码 / Class 22 数据异常

22035 no_sql_json_item

ERROR 源码确认 参考 未实测

类别
Class 22 数据异常
严重等级
ERROR
条件名
no_sql_json_item
宏名称
ERRCODE_NO_SQL_JSON_ITEM
启用版本
12
状态
活跃

版本覆盖

速览

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

报文

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

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

报文模板

源码里的格式串,不是某一次运行的输出。%s 之类是占位符,实际报文会填入对象名与取值。适用范围一栏是核验时留下的原始英文记录,未经翻译。

主消息 no SQL/JSON item found for specified path of column "%s"

来源:src/backend/executor/execExprInterp.c @ REL_18_6

主消息 no SQL/JSON item found for specified path

来源:src/backend/executor/execExprInterp.c @ REL_18_6

含义

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

诊断

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

处理

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

版本

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

来源

证据

断言

每条断言都写明了是怎么核实的,以及它不覆盖什么。这一层是核验时留下的原始英文记录,照原样呈现,未经翻译。

  • 22035 is no_sql_json_item in SQLSTATE Class 22.

    核实方式Read fixed definition.

    来源src/backend/utils/errcodes.txt

  • 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.

    核实方式Read JsonPathValue empty handling and ExecEvalJsonExprPath ON EMPTY/ON ERROR branches.

    不覆盖Source confirmation is not a natural runtime observation.

    来源src/backend/executor/execExprInterp.c · src/backend/executor/execExprInterp.c

  • The locked catalogue records 22035 from 12.0 without proving exact implementation introduction.

    核实方式Use catalogue boundary.

    来源src/backend/utils/errcodes.txt

同类错误代码

Class 22 数据异常 下的其他成员。