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

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

Wiki / SQLSTATE

2203A — sql_json_member_not_found

JSON 对象成员不存在或当前项不是对象。

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

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

aliases
未知
class name
Data Exception
condition name
sql_json_member_not_found
lang
en
sqlstate
2203A

版本定义 PG 18

2203A

速览 {#at-a-glance}

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

报文 {#messages}

代表性首要报文如下:

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

含义 {#meaning}

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

诊断 {#diagnosis}

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

处理 {#response}

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

版本 {#versions}

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

相关 {#related}

22039、2203C、22035

来源 {#sources}

具名成员查找、键缺失、非对象和结构错误分支见 jsonpath_exec.c#L1012-1055。共享 strict/lax 与抛出/返回宏见 jsonpath_exec.c#L235-249。结构化证据记录绑定两条准确首要报文;本页未运行自然案例。

比较版本

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

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read fixed definition.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "2203A is sql_json_member_not_found in SQLSTATE Class 22."
}
claims · resolved-path
{
  "claim_id": "resolved-path",
  "limits": "Source confirmation is not a natural runtime observation.",
  "method": "Read the complete jpiKey member lookup, missing-key branch, non-object branch, and structural-error suppression.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.jsonpath.member-accessor",
    "src.jsonpath.context-flags",
    "src.jsonpath.execute-context"
  ],
  "statement": "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."
}
claims · history
{
  "claim_id": "history",
  "limits": "",
  "method": "Use catalogue boundary.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked catalogue records 2203A from 12.0 without proving exact implementation introduction."
}
messages · message.missing-key
{
  "limits": "",
  "message_id": "message.missing-key",
  "path": "",
  "position": 0,
  "raw": {
    "id": "message.missing-key",
    "primary_template": "JSON object does not contain key \"%s\"",
    "severity_source": "ERROR",
    "sources": [
      "src.jsonpath.member-accessor"
    ],
    "sqlstate": "2203A"
  },
  "severity": "ERROR",
  "sources": [
    "src.jsonpath.member-accessor"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "JSON object does not contain key \" \"",
      "position": 0,
      "role": "",
      "template": "JSON object does not contain key \"%s\""
    }
  ]
}
messages · message.member-object
{
  "limits": "",
  "message_id": "message.member-object",
  "path": "",
  "position": 1,
  "raw": {
    "id": "message.member-object",
    "primary_template": "jsonpath member accessor can only be applied to an object",
    "severity_source": "ERROR",
    "sources": [
      "src.jsonpath.member-accessor"
    ],
    "sqlstate": "2203A"
  },
  "severity": "ERROR",
  "sources": [
    "src.jsonpath.member-accessor"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "jsonpath member accessor can only be applied to an object",
      "position": 0,
      "role": "",
      "template": "jsonpath member accessor can only be applied to an object"
    }
  ]
}
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#L225"
}
sources · src.jsonpath.member-accessor
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/adt/jsonpath_exec.c",
  "position": 1,
  "sha256": "678cb8947f0b5e6ad14524f1863987ab99641cfb5f81121fc5c5006af0319d02",
  "source_id": "src.jsonpath.member-accessor",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/jsonpath_exec.c#L1012"
}
sources · src.jsonpath.context-flags
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/adt/jsonpath_exec.c",
  "position": 2,
  "sha256": "678cb8947f0b5e6ad14524f1863987ab99641cfb5f81121fc5c5006af0319d02",
  "source_id": "src.jsonpath.context-flags",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/jsonpath_exec.c#L235"
}
sources · src.jsonpath.execute-context
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/adt/jsonpath_exec.c",
  "position": 3,
  "sha256": "678cb8947f0b5e6ad14524f1863987ab99641cfb5f81121fc5c5006af0319d02",
  "source_id": "src.jsonpath.execute-context",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/jsonpath_exec.c#L654"
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:87f92d08840f7cc0f718577360434bdca2d55eb748d454b9e0013d6923d47cb4

正文语言: zh-Hans · english-manuals:87f92d08840f7cc0f718577360434bdca2d55eb748d454b9e0013d6923d47cb4