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

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

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

2203A sql_json_member_not_found

ERROR 源码确认 参考 未实测

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

版本覆盖

速览

无法从当前 JSON 项中读取指定的对象成员。固定 jsonpath 成员访问区分键不存在与接收项不是对象。

报文

代表性首要报文如下:

触发条件 首要报文
对象中没有指定键 JSON object does not contain key "%s"
成员访问器收到非对象 jsonpath member accessor can only be applied to an object

报文模板

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

主消息 JSON object does not contain key "%s"

来源:src/backend/utils/adt/jsonpath_exec.c @ REL_18_6

主消息 jsonpath member accessor can only be applied to an object

来源:src/backend/utils/adt/jsonpath_exec.c @ REL_18_6

含义

jpiKey 分支会在当前 JSON 对象中查找请求的键。在会抛错的上下文中,键不存在会报告 2203A;标量或其他非对象接收项也使用本码,但首要报文不同。忽略结构错误时可以跳过这种不匹配;非抛错上下文则会把路径错误结果交给调用方处理。这是具名成员边界;通配成员访问和 .keyvalue() 使用只接受对象的 2203C 路径。

诊断

保留请求的键、成员访问器前一步收到的项,以及路径模式。键不存在可能是文档形状问题;非对象接收项则表示路径到达了错误类型。没有读取首要报文时,不要把成员缺失归为 22035 无项,或把通配/对象方法不匹配归为 2203C。

处理

修正键名,或按文档形状规范化并显式分支。只有当成员缺失确实是预期输入时,才使用路径文档规定的 lax 或错误处理行为。如果 ERROR 发生在显式事务中,应先 ROLLBACK 或回滚到既有保存点再重试;自动提交可重试修正后的动作。

版本

锁定目录从 12.0 起记录该条件;固定的具名成员 检查条件来自 PostgreSQL 18.6。本页未声称有自然运行观察。

来源

证据

断言

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

  • 2203A is sql_json_member_not_found in SQLSTATE Class 22.

    核实方式Read fixed definition.

    来源src/backend/utils/errcodes.txt

  • The fixed named-member jsonpath accessor looks up a key on an object and reports 2203A when the key is absent or the accessor receives a non-object item, unless structural errors are being ignored. A non-throwing jsonpath context can return a path error result; the actual ERROR path carries either the missing-key primary or the object-type primary.

    核实方式Read the complete jpiKey member lookup, missing-key branch, non-object branch, and structural-error suppression.

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

    来源src/backend/utils/adt/jsonpath_exec.c · src/backend/utils/adt/jsonpath_exec.c · src/backend/utils/adt/jsonpath_exec.c

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

    核实方式Use catalogue boundary.

    来源src/backend/utils/errcodes.txt

同类错误代码

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